Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/multiversx/mx-chain-core-go v1.2.1
github.com/multiversx/mx-chain-crypto-go v1.2.6
github.com/multiversx/mx-chain-logger-go v1.0.11
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230516140717-d1799bcc9bfd
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230601140851-43257b12e826
github.com/multiversx/mx-chain-vm-common-go v1.4.2-0.20230509130344-9d241d34991f
github.com/multiversx/mx-components-big-int v0.1.1
github.com/pelletier/go-toml v1.9.3
Expand All @@ -21,6 +21,7 @@ require (

require (
github.com/TwiN/go-color v1.1.0 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
Expand Down
8 changes: 5 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ=
github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down Expand Up @@ -87,15 +88,16 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiversx/mx-chain-core-go v1.1.30/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk=
github.com/multiversx/mx-chain-core-go v1.1.36/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk=
github.com/multiversx/mx-chain-core-go v1.2.1 h1:kmDfK7Znl3S0IJlDEE4sFuBOmA2rZkBudxlGhI1bvQc=
github.com/multiversx/mx-chain-core-go v1.2.1/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk=
github.com/multiversx/mx-chain-crypto-go v1.2.6 h1:yxsjAQGh62los+iYmORMfh3w9qen0xbYlmwU0juNSeg=
github.com/multiversx/mx-chain-crypto-go v1.2.6/go.mod h1:rOj0Rr19HTOYt9YTeym7RKxlHt91NXln3LVKjHKVmA0=
github.com/multiversx/mx-chain-logger-go v1.0.11 h1:DFsHa+sc5fKwhDR50I8uBM99RTDTEW68ESyr5ALRDwE=
github.com/multiversx/mx-chain-logger-go v1.0.11/go.mod h1:1srDkP0DQucWQ+rYfaq0BX2qLnULsUdRPADpYUTM6dA=
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230516140717-d1799bcc9bfd h1:nugF4RKzOYUpcSifld9L4I4GiC84v2NVX9H08KV7r44=
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230516140717-d1799bcc9bfd/go.mod h1:xl+aL6n3aibMtfJH3hFGxzddWmn1hEx2Fg0c6ahoQvU=
github.com/multiversx/mx-chain-vm-common-go v1.3.33-0.20230123162357-c6f6931a3dec/go.mod h1:sZ2COLCxvf2GxAAJHGmGqWybObLtFuk2tZUyGqnMXE8=
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230601140851-43257b12e826 h1:GjiLbRfuZBynL7VKCwjjVARRkeL7qcJBoGG1iU/y3jY=
github.com/multiversx/mx-chain-scenario-go v1.1.3-0.20230601140851-43257b12e826/go.mod h1:kk5BsmK5FF+gleXfJ1SMD3XaxVE8PpdRh2tzGLhbJZc=
github.com/multiversx/mx-chain-vm-common-go v1.3.38/go.mod h1:+zuF/XIXiwGuLJAdK9t23w79GH9d8Q+lF2xdbnLtAng=
github.com/multiversx/mx-chain-vm-common-go v1.4.2-0.20230509130344-9d241d34991f h1:H37/a22h+mvIJgb0sC3WzSav8Wz/IhD5rU65D/CHRLU=
github.com/multiversx/mx-chain-vm-common-go v1.4.2-0.20230509130344-9d241d34991f/go.mod h1:K6yCdro8VohzYI6GwjGzTO+fJiPgO5coo2sgQb+zA24=
github.com/multiversx/mx-components-big-int v0.1.1 h1:695mYPKYOrmGEGgRH4/pZruDoe3CPP1LHrBxKfvj5l4=
Expand Down
9 changes: 9 additions & 0 deletions scenarioexec/stepRunTx.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ func (ae *VMTestExecutor) executeTx(txIndex string, tx *mj.Transaction) (*vmcomm
if ae.PeekTraceGas() {
fmt.Println("\nIn txID:", txIndex, ", step type:Deploy", ", total gas used:", gasForExecution-output.GasRemaining)
}
case mj.ScUpgrade:
output, err = ae.scCall(txIndex, tx, gasForExecution)
ae.upgradeContract()
if err != nil {
return nil, err
}
if ae.PeekTraceGas() {
fmt.Println("\nIn txID:", txIndex, ", step type:ScUpgrade, total gas used:", gasForExecution-output.GasRemaining)
}
case mj.ScQuery:
// imitates the behaviour of the protocol
// the sender is the contract itself during SC queries
Expand Down
48 changes: 48 additions & 0 deletions test/features/composability/scenarios/simple_upgrade.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"gasSchedule": "v3",
"steps": [
{
"step": "setState",
"accounts": {
"address:a_user": {
"nonce": "0",
"balance": "1000"
},
"sc:forwarder": {
"nonce": "0",
"balance": "0",
"code": "file:../forwarder-raw/output/forwarder-raw.wasm"
}
}
},
{
"step": "scCall",
"id": "1",
"tx": {
"from": "address:a_user",
"to": "sc:forwarder",
"function": "upgradeContract",
"arguments": [
"file:../vault/output/vault.wasm",
"0x0502"
],
"gasLimit": "50,000,000",
"gasPrice": "0"
}
},
{
"step": "checkState",
"accounts": {
"address:a_user": {
"nonce": "*",
"balance": "*",
"storage": {},
"code": ""
},
"sc:forwarder": {
"code": "file:../vault/output/vault.wasm"
}
}
}
]
}