Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom compiler example #1067

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
110 changes: 110 additions & 0 deletions BlockchainTests/GeneralStateTests/stExample/customCompilerExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"customCompilerExample_d0g0v0_Merge" : {
"_info" : {
"comment" : "An example of using custom tool to compile the src in code field",
"filling-rpc-server" : "evm version 1.10.22-unstable-fea569f9-20220729",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.766b4629.Linux.g++",
"generatedTestHash" : "04cb51125b7a0bcc2a3db7c24055b038479983cc82ae722866b85371f560f5e3",
"lllcversion" : "Version: 0.5.14-develop.2022.7.30+commit.a096d7a9.Linux.g++",
"solidity" : "Version: 0.8.5+commit.a4f2e591.Linux.g++",
"source" : "src/GeneralStateTestsFiller/stExample/customCompilerExampleFiller.yml",
"sourceHash" : "73c703b157cd613288fa817911e5d646bbde37691a604a3018bbf9eb9020481d"
},
"blocks" : [
{
"blockHeader" : {
"baseFeePerGas" : "0x0a",
"bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"difficulty" : "0x00",
"extraData" : "0x00",
"gasLimit" : "0x05f5e100",
"gasUsed" : "0xa862",
"hash" : "0xfd9837e1862b2cec1d5c1067376df1ba3c1f386d0dfdc99c0b81b76aa727de5e",
"mixHash" : "0x0000000000000000000000000000000000000000000000000000000000020000",
"nonce" : "0x0000000000000000",
"number" : "0x01",
"parentHash" : "0x6cfdda8f7f05aba63266108a9a04e981c23e97bad5507e762baa59e7dcc8ae50",
"receiptTrie" : "0xb0c757a6d58893c8db5b0ba3f7aa4420fef0b313c5d91e5512264f4bd315bc98",
"stateRoot" : "0xb4f5c70a081a7d7f2c39e69a677f478bb906c137507e026ab78e0c3b981f7275",
"timestamp" : "0x03e8",
"transactionsTrie" : "0xe2cbe2cb357c86369370ef5f55e52c64fd4c7fab573dca71566c303f664c6e7e",
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"rlp" : "0xf9025ff901f6a06cfdda8f7f05aba63266108a9a04e981c23e97bad5507e762baa59e7dcc8ae50a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0b4f5c70a081a7d7f2c39e69a677f478bb906c137507e026ab78e0c3b981f7275a0e2cbe2cb357c86369370ef5f55e52c64fd4c7fab573dca71566c303f664c6e7ea0b0c757a6d58893c8db5b0ba3f7aa4420fef0b313c5d91e5512264f4bd315bc98b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080018405f5e10082a8628203e800a000000000000000000000000000000000000000000000000000000000000200008800000000000000000af863f861800a8404c4b40094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba0341cbeace0edb5051180861215a6174e9bd7a871dd671398cb3ff6fec62c669aa0570545f3df8983280e93798904627a4214fef67fef406bde99f2aa96087a89e5c0",
"transactions" : [
{
"data" : "0x",
"gasLimit" : "0x04c4b400",
"gasPrice" : "0x0a",
"nonce" : "0x00",
"r" : "0x341cbeace0edb5051180861215a6174e9bd7a871dd671398cb3ff6fec62c669a",
"s" : "0x570545f3df8983280e93798904627a4214fef67fef406bde99f2aa96087a89e5",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
],
"uncleHeaders" : [
]
}
],
"genesisBlockHeader" : {
"baseFeePerGas" : "0x0b",
"bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"difficulty" : "0x00",
"extraData" : "0x00",
"gasLimit" : "0x05f5e100",
"gasUsed" : "0x00",
"hash" : "0x6cfdda8f7f05aba63266108a9a04e981c23e97bad5507e762baa59e7dcc8ae50",
"mixHash" : "0x0000000000000000000000000000000000000000000000000000000000020000",
"nonce" : "0x0000000000000000",
"number" : "0x00",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "0x753d34116924af43a17fefd96f62ca0e835ad5250994df56e4ca1701e8916576",
"timestamp" : "0x00",
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"genesisRLP" : "0xf901f7f901f2a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0753d34116924af43a17fefd96f62ca0e835ad5250994df56e4ca1701e8916576a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080808405f5e100808000a000000000000000000000000000000000000000000000000000000000000200008800000000000000000bc0c0",
"lastblockhash" : "0xfd9837e1862b2cec1d5c1067376df1ba3c1f386d0dfdc99c0b81b76aa727de5e",
"network" : "Merge",
"postState" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x0ba1a9ce0ba1a9ce",
"code" : "0x600360005500",
"nonce" : "0x00",
"storage" : {
"0x00" : "0x03"
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0ba1a9ce0b9b15fa",
"code" : "0x",
"nonce" : "0x01",
"storage" : {
}
}
},
"pre" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x0ba1a9ce0ba1a9ce",
"code" : "0x600360005500",
"nonce" : "0x00",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0ba1a9ce0ba1a9ce",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
},
"sealEngine" : "NoProof"
}
}
70 changes: 70 additions & 0 deletions GeneralStateTests/stExample/customCompilerExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"customCompilerExample" : {
"_info" : {
"comment" : "An example of using custom tool to compile the src in code field",
"filling-rpc-server" : "evm version 1.10.22-unstable-fea569f9-20220729",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.766b4629.Linux.g++",
"generatedTestHash" : "67dcb3d38be2c9566f6069eee9074cf157f64d2ed3edbf072a80623c60df202c",
"lllcversion" : "Version: 0.5.14-develop.2022.7.30+commit.a096d7a9.Linux.g++",
"solidity" : "Version: 0.8.5+commit.a4f2e591.Linux.g++",
"source" : "src/GeneralStateTestsFiller/stExample/customCompilerExampleFiller.yml",
"sourceHash" : "73c703b157cd613288fa817911e5d646bbde37691a604a3018bbf9eb9020481d"
},
"env" : {
"currentBaseFee" : "0x0a",
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x020000",
"currentGasLimit" : "0x05f5e100",
"currentNumber" : "0x01",
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000020000",
"currentTimestamp" : "0x03e8",
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"post" : {
"Merge" : [
{
"hash" : "0xb4f5c70a081a7d7f2c39e69a677f478bb906c137507e026ab78e0c3b981f7275",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf861800a8404c4b40094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba0341cbeace0edb5051180861215a6174e9bd7a871dd671398cb3ff6fec62c669aa0570545f3df8983280e93798904627a4214fef67fef406bde99f2aa96087a89e5"
}
]
},
"pre" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x0ba1a9ce0ba1a9ce",
"code" : "0x600360005500",
"nonce" : "0x00",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0ba1a9ce0ba1a9ce",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
},
"transaction" : {
"data" : [
"0x"
],
"gasLimit" : [
"0x04c4b400"
],
"gasPrice" : "0x0a",
"nonce" : "0x00",
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : [
"0x00"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# An example of using custom tool to compile the src in code field
customCompilerExample:
_info:
comment: An example of using custom tool to compile the src in code field

env:
currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
currentDifficulty: '0x20000'
currentGasLimit: "100000000"
currentNumber: "1"
currentTimestamp: "1000"
previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6

expect:
- indexes:
data: !!int -1
gas: !!int 0
value: !!int -1

network:
- '>=Merge'
result:
095e7baea6a6c7c4c2dfeb977efac326af552d87:
storage:
0: 3

pre:

# requires solc compiler to be installed in the system
095e7baea6a6c7c4c2dfeb977efac326af552d87:
balance: '0x0ba1a9ce0ba1a9ce'
code: |
:mycompiler
{
ANY CUSTOM SRC CODE HERE
the script to compile this message into bytecode is in .retesteth/default/mycompiler.sh
}
nonce: '0'
storage: {}

a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: '0x0ba1a9ce0ba1a9ce'
code: '0x'
nonce: '0'
storage: {}


transaction:
data:
- ""
gasLimit:
- '80000000'
gasPrice: '10'
nonce: '0'
to: 095e7baea6a6c7c4c2dfeb977efac326af552d87
value:
- '0'
secretKey: '45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8'