-
Notifications
You must be signed in to change notification settings - Fork 9
WIP:Handle system call #178
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d63fcec
handle system call
curryxbo 0e1f0ec
revert unnecessary changes
curryxbo c010158
revert unnecessary changes
curryxbo ba82b8b
fix consensus
curryxbo 398705e
fix RewardStartedSlot
curryxbo ab009e6
handle errors
curryxbo 5cb82d5
clean
curryxbo c8da88a
max gas
curryxbo be650e1
Refine the getSystemResult implementation
curryxbo a02f950
refactor start hook
curryxbo 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
package l2staking | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"sync" | ||
|
||
"github.com/morph-l2/go-ethereum/accounts/abi" | ||
"github.com/morph-l2/go-ethereum/common" | ||
) | ||
|
||
const jsonData = `[{"inputs":[{"internalType":"address","name":"sequencerAddr","type":"address"}],"name":"recordBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"}]` | ||
|
||
var ( | ||
l2StakingABI *abi.ABI | ||
loadOnce sync.Once | ||
loadErr error | ||
) | ||
|
||
func Abi() (*abi.ABI, error) { | ||
loadOnce.Do(func() { | ||
stakingABI, err := abi.JSON(strings.NewReader(jsonData)) | ||
if err != nil { | ||
loadErr = fmt.Errorf("failed to parse ABI: %w", err) | ||
return | ||
} | ||
l2StakingABI = &stakingABI | ||
}) | ||
return l2StakingABI, loadErr | ||
} | ||
|
||
func PacketData(addr common.Address) ([]byte, error) { | ||
a, err := Abi() | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get ABI: %w", err) | ||
} | ||
data, err := a.Pack("recordBlocks", addr) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to pack data: %w", err) | ||
} | ||
return data, nil | ||
} |
This file contains hidden or 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,13 @@ | ||
package l2staking | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/morph-l2/go-ethereum/common" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPackData(t *testing.T) { | ||
_, err := PacketData(common.HexToAddress("0x01")) | ||
require.NoError(t, err) | ||
} |
This file contains hidden or 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,41 @@ | ||
package morphtoken | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"sync" | ||
|
||
"github.com/morph-l2/go-ethereum/accounts/abi" | ||
) | ||
|
||
const jsonData = `[{"inputs":[],"name":"mintInflations","outputs":[],"stateMutability":"nonpayable","type":"function"}]` | ||
|
||
var ( | ||
morphTokenABI *abi.ABI | ||
loadOnce sync.Once | ||
loadErr error | ||
) | ||
|
||
func Abi() (*abi.ABI, error) { | ||
loadOnce.Do(func() { | ||
tokenABI, err := abi.JSON(strings.NewReader(jsonData)) | ||
if err != nil { | ||
loadErr = fmt.Errorf("failed to parse ABI: %w", err) | ||
return | ||
} | ||
morphTokenABI = &tokenABI | ||
}) | ||
return morphTokenABI, loadErr | ||
} | ||
|
||
func PacketData() ([]byte, error) { | ||
a, err := Abi() | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get ABI: %w", err) | ||
} | ||
data, err := a.Pack("mintInflations") | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to pack data: %w", err) | ||
} | ||
return data, nil | ||
} |
This file contains hidden or 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,12 @@ | ||
package morphtoken | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPackData(t *testing.T) { | ||
_, err := PacketData() | ||
require.NoError(t, err) | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.