Skip to content

Commit

Permalink
revert cases in testdata/istanbul
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc committed Oct 19, 2023
1 parent 2efc3a4 commit c38eae4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
24 changes: 13 additions & 11 deletions action/protocol/execution/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func readExecution(
return sf.SimulateExecution(ctx, addr, exec, dao.GetBlockHash)
}

func runExecutions(
func (sct *SmartContractTest) runExecutions(
bc blockchain.Blockchain,
sf factory.Factory,
dao blockdao.BlockDAO,
Expand Down Expand Up @@ -325,12 +325,14 @@ func runExecutions(
return nil, nil, err
}
builder := &action.EnvelopeBuilder{}
elp := builder.SetAction(exec).
builder = builder.SetAction(exec).
SetNonce(exec.Nonce()).
SetGasLimit(ecfg.GasLimit()).
SetGasPrice(ecfg.GasPrice()).
SetChainID(bc.ChainID()).
Build()
SetGasPrice(ecfg.GasPrice())
if sct.InitGenesis.IsParis {
builder = builder.SetChainID(bc.ChainID())
}
elp := builder.Build()
selp, err := action.Sign(elp, ecfg.PrivateKey())
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -481,7 +483,7 @@ func (sct *SmartContractTest) deployContracts(
if contract.AppendContractAddress {
contract.ContractAddressToAppend = contractAddresses[contract.ContractIndexToAppend]
}
receipts, _, err := runExecutions(bc, sf, dao, ap, []*ExecutionConfig{&contract}, []string{action.EmptyAddress})
receipts, _, err := sct.runExecutions(bc, sf, dao, ap, []*ExecutionConfig{&contract}, []string{action.EmptyAddress})
r.NoError(err)
r.Equal(1, len(receipts))
receipt := receipts[0]
Expand Down Expand Up @@ -556,7 +558,7 @@ func (sct *SmartContractTest) run(r *require.Assertions) {
}
} else {
var receipts []*action.Receipt
receipts, blkInfo, err = runExecutions(bc, sf, dao, ap, []*ExecutionConfig{&exec}, []string{contractAddr})
receipts, blkInfo, err = sct.runExecutions(bc, sf, dao, ap, []*ExecutionConfig{&exec}, []string{contractAddr})
r.NoError(err)
r.Equal(1, len(receipts))
receipt = receipts[0]
Expand Down Expand Up @@ -1327,7 +1329,7 @@ func benchmarkHotContractWithFactory(b *testing.B, async bool) {
contractAddr := contractAddresses[0]
b.ResetTimer()
for i := 0; i < b.N; i++ {
receipts, _, err := runExecutions(
receipts, _, err := sct.runExecutions(
bc, sf, dao, ap, []*ExecutionConfig{
{
RawPrivateKey: "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1",
Expand Down Expand Up @@ -1358,7 +1360,7 @@ func benchmarkHotContractWithFactory(b *testing.B, async bool) {
})
contractAddrs = append(contractAddrs, contractAddr)
}
receipts, _, err = runExecutions(bc, sf, dao, ap, ecfgs, contractAddrs)
receipts, _, err = sct.runExecutions(bc, sf, dao, ap, ecfgs, contractAddrs)
r.NoError(err)
for _, receipt := range receipts {
r.Equal(uint64(1), receipt.Status)
Expand Down Expand Up @@ -1404,7 +1406,7 @@ func benchmarkHotContractWithStateDB(b *testing.B, cachedStateDBOption bool) {
contractAddr := contractAddresses[0]
b.ResetTimer()
for i := 0; i < b.N; i++ {
receipts, _, err := runExecutions(
receipts, _, err := sct.runExecutions(
bc, sf, dao, ap, []*ExecutionConfig{
{
RawPrivateKey: "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1",
Expand Down Expand Up @@ -1435,7 +1437,7 @@ func benchmarkHotContractWithStateDB(b *testing.B, cachedStateDBOption bool) {
})
contractAddrs = append(contractAddrs, contractAddr)
}
receipts, _, err = runExecutions(bc, sf, dao, ap, ecfgs, contractAddrs)
receipts, _, err = sct.runExecutions(bc, sf, dao, ap, ecfgs, contractAddrs)
r.NoError(err)
for _, receipt := range receipts {
r.Equal(uint64(1), receipt.Status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"rawExpectedGasConsumed": 12300,
"comment": "launch attack(https://etherscan.io/tx/0x1cb6fb36633d270edefc04d048145b4298e67b8aa82a9e5ec4aa1435dd770ce4)",
"expectedBlockInfos" : {
"txRootHash" : "3bf0c639b6fb9228b0f042c0e30bc60f6b41f081225e707a9b8c8a27d8dc9b77",
"txRootHash" : "a59ead74a3870e9b5ca352c5f59108df402ca203ef2109799fe2d8e1da49c83d",
"stateRootHash" : "ed9bd589ee5ab5660a3d5d863bbeea13020a0aacab18e8655a626beaf9a54713",
"receiptRootHash" : "0987852162cc8b45e640ebe235bf7cbce91252cb55871fa4f7dd66ab910d8c0d"
"receiptRootHash" : "3285579efa8521fbf95829b868ff5d37632c4feac6167e9ab2dc4961004c9272"
}
}]
}
4 changes: 2 additions & 2 deletions action/protocol/execution/testdata-istanbul/datacopy.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"expectedStatus": 1,
"comment": "the data of return is [0x11, 0x22, 0x33]",
"expectedBlockInfos" : {
"txRootHash" : "b34ab55e292dbd6a33338015bdd141881bb3cae5eeebb70264653d470c7ec0d7",
"txRootHash" : "3672945ca662bea4dd977e799374c5ce36c0c3e9ecbe98f1655f33439bbfe40c",
"stateRootHash" : "244ff11fa850cbd07b490db861e95ce0ae8e76a18b3c0093cbaeadee0d34e1f8",
"receiptRootHash" : "386ec9e1ea1ad2b441556dfe6855f8d9275f153bec54b6a6e4d38025a92dbb00"
"receiptRootHash" : "973667a354122928d6df937faea2d989401a705aa1769b9d594e00cb714c3a0b"
}
}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"rawExpectedGasConsumed": 12300,
"comment": "launch attack(https://etherscan.io/tx/0x1cb6fb36633d270edefc04d048145b4298e67b8aa82a9e5ec4aa1435dd770ce4)",
"expectedBlockInfos" : {
"txRootHash" : "3bf0c639b6fb9228b0f042c0e30bc60f6b41f081225e707a9b8c8a27d8dc9b77",
"txRootHash" : "a59ead74a3870e9b5ca352c5f59108df402ca203ef2109799fe2d8e1da49c83d",
"stateRootHash" : "ed9bd589ee5ab5660a3d5d863bbeea13020a0aacab18e8655a626beaf9a54713",
"receiptRootHash" : "0987852162cc8b45e640ebe235bf7cbce91252cb55871fa4f7dd66ab910d8c0d"
"receiptRootHash" : "3285579efa8521fbf95829b868ff5d37632c4feac6167e9ab2dc4961004c9272"
}
}]
}
4 changes: 2 additions & 2 deletions action/protocol/execution/testdata/datacopy.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"rawExpectedGasConsumed": 32504,
"comment": "the data of return is [0x11, 0x22, 0x33]",
"expectedBlockInfos" : {
"txRootHash" : "b34ab55e292dbd6a33338015bdd141881bb3cae5eeebb70264653d470c7ec0d7",
"txRootHash" : "3672945ca662bea4dd977e799374c5ce36c0c3e9ecbe98f1655f33439bbfe40c",
"stateRootHash" : "6fb3dc7f5ef66ce9b384f034191d6a67801e01961ecd824061c4101035844667",
"receiptRootHash" : "f8bcba906a07facff9913a1e5f0b95e30b271bc87dbeba8daf3455cbaaad1cad"
"receiptRootHash" : "0dfe7718f029aaffccd9c20bfaa50a1fb3405014de68af4f89516160de53d2f2"
}
}]
}

0 comments on commit c38eae4

Please sign in to comment.