Skip to content

Commit

Permalink
fix: use submitCheckpoint method for sending checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkanani committed Feb 12, 2021
1 parent 1a29222 commit 3b9f572
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 128 deletions.
68 changes: 22 additions & 46 deletions contracts/rootchain/rootchain.abi
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
[
{
"constant": false,
"inputs": [
{
"name": "data",
"type": "bytes"
},
{
"name": "sigs",
"type": "uint256[3][]"
}
],
"name": "submitHeaderBlock",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "max_deposits",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
Expand Down Expand Up @@ -67,31 +35,39 @@
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "currentEpoch",
"outputs": [
"constant": false,
"inputs": [
{
"name": "",
"type": "uint256"
"name": "data",
"type": "bytes"
},
{
"name": "sigs",
"type": "uint256[3][]"
}
],
"name": "submitCheckpoint",
"outputs": [],
"payable": false,
"stateMutability": "view",
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_nextHeaderBlock",
"outputs": [
"constant": false,
"inputs": [
{
"name": "",
"type": "uint256"
"name": "data",
"type": "bytes"
},
{
"name": "sigs",
"type": "bytes"
}
],
"name": "submitHeaderBlock",
"outputs": [],
"payable": false,
"stateMutability": "view",
"stateMutability": "nonpayable",
"type": "function"
},
{
Expand Down
101 changes: 22 additions & 79 deletions contracts/rootchain/rootchain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions helper/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func GenerateAuthObj(client *ethclient.Client, address common.Address, data []by
// SendCheckpoint sends checkpoint to rootchain contract
// todo return err
func (c *ContractCaller) SendCheckpoint(signedData []byte, sigs [][3]*big.Int, rootChainAddress common.Address, rootChainInstance *rootchain.Rootchain) (er error) {
data, err := c.RootChainABI.Pack("submitHeaderBlock", signedData, sigs)
data, err := c.RootChainABI.Pack("submitCheckpoint", signedData, sigs)
if err != nil {
Logger.Error("Unable to pack tx for submitHeaderBlock", "error", err)
Logger.Error("Unable to pack tx for submitCheckpoint", "error", err)
return err
}

Expand All @@ -86,7 +86,7 @@ func (c *ContractCaller) SendCheckpoint(signedData []byte, sigs [][3]*big.Int, r
"data", hex.EncodeToString(signedData),
)

tx, err := rootChainInstance.SubmitHeaderBlock(auth, signedData, sigs)
tx, err := rootChainInstance.SubmitCheckpoint(auth, signedData, sigs)
if err != nil {
Logger.Error("Error while submitting checkpoint", "error", err)
return err
Expand Down

0 comments on commit 3b9f572

Please sign in to comment.