Skip to content

Commit

Permalink
Merge pull request #538 from maticnetwork/jdkanani/change-checkpoint-…
Browse files Browse the repository at this point in the history
…sig-mainnet

chg: change rootchain submitHeaderBlock interface (Mainnet v1 changes)
  • Loading branch information
jdkanani authored Mar 10, 2021
2 parents 1d8aca3 + 3b9f572 commit 66c0e82
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 127 deletions.
14 changes: 8 additions & 6 deletions bridge/setu/processor/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,12 @@ func (sp *SlashingProcessor) createAndSendTickToRootchain(height int64, txHash [
sp.Logger.Info("sideTx data", "sideTxData", hex.EncodeToString(sideTxData))

// get sigs
sigs, err := helper.FetchSideTxSigs(sp.httpClient, height, tx.Tx.Hash(), sideTxData)
if err != nil {
sp.Logger.Error("Error fetching votes for tick tx", "height", height)
return err
}
// TODO pass sigs in proper form in `SendTick` for slashing
// sigs, err := helper.FetchSideTxSigs(sp.httpClient, height, tx.Tx.Hash(), sideTxData)
// if err != nil {
// sp.Logger.Error("Error fetching votes for tick tx", "height", height)
// return err
// }

// send tick to rootchain
slashingContrext, err := sp.getSlashingContext()
Expand All @@ -327,7 +328,8 @@ func (sp *SlashingProcessor) createAndSendTickToRootchain(height int64, txHash [
return err
}

if err := sp.contractConnector.SendTick(sideTxData, sigs, slashManagerAddress, slashManagerInstance); err != nil {
// TODO pass sigs in proper form in `SendTick` for slashing
if err := sp.contractConnector.SendTick(sideTxData, nil, slashManagerAddress, slashManagerInstance); err != nil {
sp.Logger.Info("Error submitting tick to slashManager contract", "error", err)
return err
}
Expand Down
8 changes: 6 additions & 2 deletions client/tx/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,15 @@ func QuerySideTxRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
preCommits := blockDetails.Block.LastCommit.Precommits

// extract side-tx signs from votes
sigs := helper.GetSideTxSigs(tx.Tx.Hash(), sideTxData, preCommits)
sigs, err := helper.GetSideTxSigs(tx.Tx.Hash(), sideTxData, preCommits)
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, "Error while fetching sigs")
return
}

// commit tx proof
result := hmRest.SideTxProof{
Sigs: hex.EncodeToString(sigs),
Sigs: sigs,
Tx: hex.EncodeToString(tx.Tx),
Data: hex.EncodeToString(sideTxData),
}
Expand Down
119 changes: 58 additions & 61 deletions contracts/rootchain/rootchain.abi
Original file line number Diff line number Diff line change
@@ -1,141 +1,138 @@
[
{
"anonymous": false,
"constant": true,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "proposer",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "headerBlockId",
"name": "",
"type": "uint256"
},
}
],
"name": "headerBlocks",
"outputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "reward",
"type": "uint256"
"name": "root",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "start",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "end",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "root",
"type": "bytes32"
"name": "createdAt",
"type": "uint256"
},
{
"name": "proposer",
"type": "address"
}
],
"name": "NewHeaderBlock",
"type": "event"
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "sigs",
"type": "bytes"
"type": "uint256[3][]"
}
],
"name": "submitHeaderBlock",
"name": "submitCheckpoint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "_nextHeaderBlock",
"outputs": [
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
"name": "data",
"type": "bytes"
},
{
"name": "sigs",
"type": "bytes"
}
],
"stateMutability": "view",
"name": "submitHeaderBlock",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "currentHeaderBlock",
"name": "getLastChildBlock",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getLastChildBlock",
"name": "currentHeaderBlock",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "headerBlocks",
"outputs": [
"indexed": true,
"name": "proposer",
"type": "address"
},
{
"internalType": "bytes32",
"name": "root",
"type": "bytes32"
"indexed": true,
"name": "headerBlockId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "start",
"indexed": true,
"name": "reward",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "end",
"indexed": false,
"name": "start",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "createdAt",
"indexed": false,
"name": "end",
"type": "uint256"
},
{
"internalType": "address",
"name": "proposer",
"type": "address"
"indexed": false,
"name": "root",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
"name": "NewHeaderBlock",
"type": "event"
}
]
68 changes: 31 additions & 37 deletions contracts/rootchain/rootchain.go

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

Loading

0 comments on commit 66c0e82

Please sign in to comment.