-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
L1 gas refunds for failing transactions. BaseFee not burned anymore. (#…
…1550) * Fixed known issues and added gas test that ensures network hasnt produced bad batches. * Added comment. * Fixes for linter. * Ran gofumpt. * no gas. * Disabled gas test. --------- Co-authored-by: StefanIliev545 <[email protected]>
- Loading branch information
1 parent
a97b835
commit 8496485
Showing
10 changed files
with
164 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package helpful | ||
|
||
import ( | ||
"bufio" | ||
"context" | ||
"fmt" | ||
"math/big" | ||
"os" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/obscuronet/go-obscuro/integration/networktest/actions" | ||
|
||
"github.com/obscuronet/go-obscuro/integration/networktest" | ||
"github.com/obscuronet/go-obscuro/integration/networktest/env" | ||
) | ||
|
||
// Smoke tests are useful for checking a network is live or checking basic functionality is not broken | ||
|
||
var _transferAmount = big.NewInt(100_000_000) | ||
|
||
// Transaction with insufficient gas limit for the intrinsic cost. It should result in no difference | ||
// to user balances, but network should remain operational. | ||
// Used to automatically detect batch desync based on transaction inclusion. | ||
// Sequencer and Validator will process different transactions, but state should be identical. | ||
func TestExecuteNativeFundsTransferNoGas(t *testing.T) { | ||
networktest.TestOnlyRunsInIDE(t) | ||
networktest.Run( | ||
"gas-underlimit-test", | ||
t, | ||
env.LocalDevNetwork(), | ||
actions.Series( | ||
&actions.CreateTestUser{UserID: 0}, | ||
&actions.CreateTestUser{UserID: 1}, | ||
actions.SetContextValue(actions.KeyNumberOfTestUsers, 2), | ||
|
||
&actions.AllocateFaucetFunds{UserID: 0}, | ||
actions.SnapshotUserBalances(actions.SnapAfterAllocation), // record user balances (we have no guarantee on how much the network faucet allocates) | ||
&actions.SendNativeFunds{ | ||
FromUser: 0, | ||
ToUser: 1, | ||
Amount: _transferAmount, | ||
GasLimit: big.NewInt(11_000), | ||
SkipVerify: true, | ||
}, | ||
&actions.VerifyBalanceAfterTest{ | ||
UserID: 1, | ||
ExpectedBalance: common.Big0, | ||
}, | ||
actions.VerifyOnlyAction(func(ctx context.Context, network networktest.NetworkConnector) error { | ||
logFile, ok := (ctx.Value(networktest.LogFileKey)).(*os.File) | ||
if !ok { | ||
return fmt.Errorf("log file not provided in context") | ||
} | ||
fmt.Println(logFile.Name()) | ||
|
||
f, err := os.Open(logFile.Name()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
scanner := bufio.NewScanner(f) | ||
|
||
// https://golang.org/pkg/bufio/#Scanner.Scan | ||
for scanner.Scan() { | ||
if strings.Contains(scanner.Text(), "Error validating batch") { | ||
return fmt.Errorf("found bad batches in test logs") | ||
} | ||
} | ||
|
||
if err := scanner.Err(); err != nil { | ||
// Handle the error | ||
return err | ||
} | ||
|
||
return nil | ||
}), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters