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

Bugs/en 3228 sc processor refund gas #321

Merged
merged 12 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from 10 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
45 changes: 12 additions & 33 deletions integrationTests/multiShard/block/executingMiniblocksSc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestProcessWithScTxsTopUpAndWithdrawOnlyProposers(t *testing.T) {
initialVal := big.NewInt(10000000)
topUpValue := big.NewInt(500)
withdrawValue := big.NewInt(10)
mintAllNodes(nodes, initialVal)
integrationTests.MintAllNodes(nodes, initialVal)

deployScTx(nodes, idxNodeShard1, string(scCode))

Expand Down Expand Up @@ -182,15 +182,15 @@ func TestProcessWithScTxsJoinAndRewardTwoNodesInShard(t *testing.T) {
initialVal := big.NewInt(10000000)
topUpValue := big.NewInt(500)
withdrawValue := big.NewInt(10)
mintAllNodes(nodes, initialVal)
integrationTests.MintAllNodes(nodes, initialVal)

deployScTx(nodes, idxProposerShard1, string(scCode))

proposeBlockWithScTxs(nodes, round, idxProposers)
syncBlock(t, nodes, idxProposers, round)
round = incrementAndPrintRound(round)

nodeDoesJoinGame(nodes, idxProposerShard0, topUpValue, hardCodedScResultingAddress)
nodeJoinsGame(nodes, idxProposerShard0, topUpValue, hardCodedScResultingAddress)

roundsToWait := 6
for i := 0; i < roundsToWait; i++ {
Expand Down Expand Up @@ -243,27 +243,6 @@ func incrementAndPrintRound(round uint32) uint32 {
return round
}

func mintAllNodes(
nodes []*integrationTests.TestProcessorNode,
value *big.Int,
) {

for _, n := range nodes {
if n.ShardCoordinator.SelfId() == sharding.MetachainShardId {
continue
}

for _, n2 := range nodes {
addr := integrationTests.CreateAddresFromAddrBytes(n2.PkTxSignBytes)
if n.ShardCoordinator.ComputeId(addr) != n.ShardCoordinator.SelfId() {
continue
}

integrationTests.MintAddress(n.AccntState, n2.PkTxSignBytes, value)
}
}
}

func deployScTx(
nodes []*integrationTests.TestProcessorNode,
senderIdx int,
Expand Down Expand Up @@ -342,24 +321,24 @@ func nodeDoesTopUp(
) {

fmt.Println("Calling SC.topUp...")
txDeploy := createTxTopUp(nodes[idxNode], topUpValue, scAddress)
nodes[idxNode].SendTransaction(txDeploy)
txScCall := createTxTopUp(nodes[idxNode], topUpValue, scAddress)
nodes[idxNode].SendTransaction(txScCall)
fmt.Println("Delaying for disseminating SC call tx...")
time.Sleep(stepDelay)

fmt.Println(integrationTests.MakeDisplayTable(nodes))
}

func nodeDoesJoinGame(
func nodeJoinsGame(
nodes []*integrationTests.TestProcessorNode,
idxNode int,
joinGameVal *big.Int,
scAddress []byte,
) {

fmt.Println("Calling SC.joinGame...")
txDeploy := createTxJoinGame(nodes[idxNode], joinGameVal, scAddress)
nodes[idxNode].SendTransaction(txDeploy)
txScCall := createTxJoinGame(nodes[idxNode], joinGameVal, scAddress)
nodes[idxNode].SendTransaction(txScCall)
fmt.Println("Delaying for disseminating SC call tx...")
time.Sleep(stepDelay)

Expand Down Expand Up @@ -436,8 +415,8 @@ func nodeDoesWithdraw(
) {

fmt.Println("Calling SC.withdraw...")
txDeploy := createTxWithdraw(nodes[idxNode], withdrawValue, scAddress)
nodes[idxNode].SendTransaction(txDeploy)
txScCall := createTxWithdraw(nodes[idxNode], withdrawValue, scAddress)
nodes[idxNode].SendTransaction(txScCall)
fmt.Println("Delaying for disseminating SC call tx...")
time.Sleep(time.Second * 1)

Expand All @@ -453,8 +432,8 @@ func nodeCallsRewardAndSend(
) {

fmt.Println("Calling SC.rewardAndSendToWallet...")
txDeploy := createTxRewardAndSendToWallet(nodes[idxNodeOwner], nodes[idxNodeUser], prize, scAddress)
nodes[idxNodeOwner].SendTransaction(txDeploy)
txScCall := createTxRewardAndSendToWallet(nodes[idxNodeOwner], nodes[idxNodeUser], prize, scAddress)
nodes[idxNodeOwner].SendTransaction(txScCall)
fmt.Println("Delaying for disseminating SC call tx...")
time.Sleep(time.Second * 1)

Expand Down
1 change: 1 addition & 0 deletions integrationTests/singleShard/block/agarioV2.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
000004656305690010706C6179657242616C616E63654B657969000F706C617965725374617475734B657969000E67616D65506C61796572734B657969000A67616D654265744B657969000962616C616E63654F66690005746F705570690008776974686472617769001A7472616E736665724261636B546F506C6179657257616C6C657469000B7769746864726177416C6C69000F616464506C61796572546F47616D656900086A6F696E47616D6569001A616464506C61796572546F47616D6553746174654368616E676569000C72657761726457696E6E6572690015726577617264416E6453656E64546F57616C6C6574690007656E6447616D656900076465706F73697467000000003300618001550020670001000161010161820100021B0823170064F6000104670002000161020161820100021B0823170064F600010467000300016103016120021B0823170064F600010467000400016104016120021B0823170064F6000104680005000161A0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0111040265000002F80001000100010003540064F6000104660000FE680006000033003401F80001000100010002540043010463550043F6000068000700013301F80008000200000001F600006800080002F80001000100010002540043100464650000040304635500435705F20010000000000080A665000006F60000660000FE68000900003300F80001000100010001540022618003140C44650000046180035500235705F20010000000000100A665000106660000F60000660001FE68000A000333036180045400850F146665000006F8000C000300000820F60000660000FE68000B000133013402F8000600000000F8000C000300000820F60000660000FE67000C000361A0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF03110C2465000004F800020001000100255400A66101035500A3F800010001000100275400E8100909650000090309085500E8F8000300010001000A54014B61820100031B0D6B17056BF8000300010001000A55014BF8000400010001000C54018D0109AD55018DF60000660000FE68000D000333036180045400850F14666500000661A0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0411102665000006F800040001000100075400E8100906650000060309085500E8F8000100010001002954012A01094A55012AF60000660000FE68000E0003F8000D000300000820F80008000200000041F60000660000FE68000F000133016180025400430F0C2465000304F800040001000100055400A6F800030001000100075400E86180021409046500030461010261820100091B244A61010203094A618002618201000903244B66000016290C61800214098D6500010DF8000200010001018E6180025501C21B2D0860018F610102650000026600016180025500E26180021408D0650002106180021409E465000304F8000E0003000019E0660002F60000660003FE
Loading