-
Notifications
You must be signed in to change notification settings - Fork 39
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
L1 gas refunds for failing transactions. BaseFee not burned anymore. #1550
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a9d3c8d
Fixed known issues and added gas test that ensures network hasnt prod…
8ecaab4
Added comment.
bacb898
Fixes for linter.
ccbe071
Ran gofumpt.
719c81a
Merge remote-tracking branch 'origin/main' into siliev/l2-gas-fixes
91b73b5
Merge remote-tracking branch 'origin/main' into siliev/l2-gas-fixes
b664e86
no gas.
258953b
Disabled gas test.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,82 @@ | ||
package helpful | ||
|
||
import ( | ||
"bufio" | ||
"context" | ||
"fmt" | ||
"math/big" | ||
"os" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
"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) | ||
var _testTimeSpan = 10 * time.Second | ||
|
||
// 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.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("logFile")).(*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") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bit sad that this is the only way to find out that a validator has rejected batches haha, but nice that you found a way |
||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a comment