Skip to content

Commit

Permalink
APEX-226 batcher proposer
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcrevar committed Jun 19, 2024
1 parent 922ef99 commit 36d9761
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 107 deletions.
4 changes: 0 additions & 4 deletions command/genesis/apex_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ func getApexContracts() []*contractInfo {
artifact: contractsapi.Slots,
address: contracts.SlotsAddr,
},
{
artifact: contractsapi.UTXOsc,
address: contracts.UTXOscAddr,
},
{
artifact: contractsapi.Validators,
address: contracts.ValidatorsAddr,
Expand Down
28 changes: 2 additions & 26 deletions consensus/polybft/apex_contracts_initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ func initApex(transition *state.Transition, admin types.Address,
return err
}

if err = initUTXOsc(transition); err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -120,11 +116,9 @@ func getDataForApexContract(contract types.Address, polyBFTConfig PolyBFTConfig)
MaxNumberOfTransactions: maxNumberOfTransactions,
TimeoutBlocksNumber: timeoutBlocksNumber,
}).EncodeAbi()
case contracts.UTXOsc:
return (&contractsapi.InitializeUTXOscFn{}).EncodeAbi()
default:
return nil, fmt.Errorf("no contract defined at address %v", contract)
}

return nil, fmt.Errorf("no contract defined at address %v", contract)
}

// Apex smart contracts initialization
Expand All @@ -135,7 +129,6 @@ func initBridge(transition *state.Transition) error {
ClaimsAddress: contracts.Claims,
SignedBatchesAddress: contracts.SignedBatches,
SlotsAddress: contracts.Slots,
UtxoscAddress: contracts.UTXOsc,
ValidatorsAddress: contracts.Validators,
}

Expand Down Expand Up @@ -217,7 +210,6 @@ func initClaims(transition *state.Transition) error {
setDependenciesFn := &contractsapi.SetDependenciesClaimsFn{
BridgeAddress: contracts.Bridge,
ClaimsHelperAddress: contracts.ClaimsHelper,
Utxosc: contracts.UTXOsc,
ValidatorsAddress: contracts.Validators,
}

Expand All @@ -229,19 +221,3 @@ func initClaims(transition *state.Transition) error {
return callContract(contracts.SystemCaller,
contracts.Claims, input, "Claims.setDependencies", transition)
}

// initUTXOsc initializes UTXOsc SC
func initUTXOsc(transition *state.Transition) error {
setDependenciesFn := &contractsapi.SetDependenciesUTXOscFn{
BridgeAddress: contracts.Bridge,
ClaimsAddress: contracts.Claims,
}

input, err := setDependenciesFn.EncodeAbi()
if err != nil {
return fmt.Errorf("UTXOsc.setDependencies params encoding failed: %w", err)
}

return callContract(contracts.SystemCaller,
contracts.UTXOsc, input, "UTXOsc.setDependencies", transition)
}
4 changes: 0 additions & 4 deletions consensus/polybft/contractsapi/apex-artifacts-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ package contractsapi
"Slots.sol",
"Slots",
},
{
"UTXOsc.sol",
"UTXOsc",
},
{
"Validators.sol",
"Validators",
Expand Down
34 changes: 0 additions & 34 deletions consensus/polybft/contractsapi/apex_contractsapi.go

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

13 changes: 6 additions & 7 deletions consensus/polybft/contractsapi/apex_sc_data.go

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions consensus/polybft/contractsapi/bindings-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,16 +617,6 @@ import (
},
[]string{},
},
{
"UTXOsc",
gensc.UTXOsc,
false,
[]string{
"initialize",
"setDependencies",
},
[]string{},
},
{
"Validators",
gensc.Validators,
Expand Down
3 changes: 1 addition & 2 deletions consensus/polybft/contractsapi/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func init() {
}

// Apex contracts
Bridge, ClaimsHelper, Claims, SignedBatches, Slots, UTXOsc, Validators, err = initApexContracts()
Bridge, ClaimsHelper, Claims, SignedBatches, Slots, Validators, err = initApexContracts()
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -412,7 +412,6 @@ func init() {
"Claims": Claims,
"SignedBatches": SignedBatches,
"Slots": Slots,
"UTXOsc": UTXOsc,
"Validators": Validators,
"TestCardanoVerifySignature": TestCardanoVerifySign,
}
Expand Down
7 changes: 0 additions & 7 deletions consensus/polybft/contractsapi/init_apex.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var (
Claims *contracts.Artifact
SignedBatches *contracts.Artifact
Slots *contracts.Artifact
UTXOsc *contracts.Artifact
Validators *contracts.Artifact
)

Expand All @@ -21,7 +20,6 @@ func initApexContracts() (
claims *contracts.Artifact,
signedBatches *contracts.Artifact,
slots *contracts.Artifact,
utxosc *contracts.Artifact,
validators *contracts.Artifact,
err error) {
bridge, err = contracts.DecodeArtifact([]byte(BridgeArtifact))
Expand Down Expand Up @@ -49,11 +47,6 @@ func initApexContracts() (
return
}

utxosc, err = contracts.DecodeArtifact([]byte(UTXOscArtifact))
if err != nil {
return
}

validators, err = contracts.DecodeArtifact([]byte(ValidatorsArtifact))
if err != nil {
return
Expand Down
9 changes: 2 additions & 7 deletions contracts/system_apex.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ var (
Slots = types.StringToAddress("0xABEF000000000000000000000000000000000004")
SlotsAddr = types.StringToAddress("0xABEF000000000000000000000000000000000014")

// Address of UTXOsc proxy
UTXOsc = types.StringToAddress("0xABEF000000000000000000000000000000000005")
UTXOscAddr = types.StringToAddress("0xABEF000000000000000000000000000000000015")

// Address of Validators proxy
Validators = types.StringToAddress("0xABEF000000000000000000000000000000000006")
ValidatorsAddr = types.StringToAddress("0xABEF000000000000000000000000000000000016")
Validators = types.StringToAddress("0xABEF000000000000000000000000000000000005")
ValidatorsAddr = types.StringToAddress("0xABEF000000000000000000000000000000000015")
)

func GetApexProxyImplementationMapping() map[types.Address]types.Address {
Expand All @@ -41,7 +37,6 @@ func GetApexProxyImplementationMapping() map[types.Address]types.Address {
Claims: ClaimsAddr,
SignedBatches: SignedBatchesAddr,
Slots: SlotsAddr,
UTXOsc: UTXOscAddr,
Validators: ValidatorsAddr,
}
}
4 changes: 2 additions & 2 deletions e2e-polybft/cardanofw/test-cardano-bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ func (cb *TestCardanoBridge) RegisterChains(

errs[indx] = validator.RegisterChain(
ChainIDPrime, cb.PrimeMultisigAddr, cb.PrimeMultisigFeeAddr,
primeTokenSupply, primeOgmiosURL,
primeTokenSupply,
)
if errs[indx] != nil {
return
}

errs[indx] = validator.RegisterChain(
ChainIDVector, cb.VectorMultisigAddr, cb.VectorMultisigFeeAddr,
vectorTokenSupply, vectorOgmiosURL,
vectorTokenSupply,
)
if errs[indx] != nil {
return
Expand Down
2 changes: 0 additions & 2 deletions e2e-polybft/cardanofw/test-cardano-validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func (cv *TestCardanoValidator) RegisterChain(
multisigAddr string,
multisigFeeAddr string,
tokenSupply *big.Int,
ogmiosURL string,
) error {
return RunCommand(ResolveApexBridgeBinary(), []string{
"register-chain",
Expand All @@ -110,7 +109,6 @@ func (cv *TestCardanoValidator) RegisterChain(
"--addr", multisigAddr,
"--addr-fee", multisigFeeAddr,
"--token-supply", fmt.Sprint(tokenSupply),
"--ogmios", ogmiosURL,
"--bridge-url", cv.server.JSONRPCAddr(),
"--bridge-addr", BridgeSCAddr,
}, os.Stdout)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-sc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BRANCH=main # optimization-chain-registration
BRANCH=feat/apex-226-batcher-proposer # optimization-chain-registration

cd ./apex-bridge-smartcontracts
git checkout main
Expand Down

0 comments on commit 36d9761

Please sign in to comment.