Skip to content

Commit

Permalink
fix: skip calling 'GetBlockHeaderEnabledChains()' to bypass API error (
Browse files Browse the repository at this point in the history
…#2704)

* skip calling GetBlockHeaderEnabledChains() to bypass API error

* fix unit test

* add changelog entry

* try to skip header proof in e2e tests

---------

Co-authored-by: skosito <skostic9242@gmail.com>
  • Loading branch information
ws4charlie and skosito authored Aug 14, 2024
1 parent 811fa58 commit 43a78ef
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## v19.0.1

### Fixes

* [2704](https://github.com/zeta-chain/node/pull/2704) - skip calling `GetBlockHeaderEnabledChains()` to bypass API error

## v19.0.0

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions contrib/localnet/orchestrator/start-zetae2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ else
echo "running e2e setup..."

if [[ ! -f deployed.yml ]]; then
zetae2e local $E2E_ARGS --config config.yml --setup-only --config-out deployed.yml
zetae2e local $E2E_ARGS --config config.yml --setup-only --config-out deployed.yml --skip-header-proof
if [ $? -ne 0 ]; then
echo "e2e setup failed"
exit 1
Expand All @@ -192,7 +192,7 @@ else

echo "running e2e tests with arguments: $E2E_ARGS"

zetae2e local $E2E_ARGS --skip-setup --config deployed.yml
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-header-proof
ZETAE2E_EXIT_CODE=$?

# if e2e passed, exit with 0, otherwise exit with 1
Expand Down
13 changes: 8 additions & 5 deletions zetaclient/zetacore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,14 @@ func (c *Client) UpdateAppContext(
return fmt.Errorf("failed to get crosschain flags: %w", err)
}

blockHeaderEnabledChains, err := c.GetBlockHeaderEnabledChains(ctx)
if err != nil {
c.logger.Info().Msg("Unable to fetch block header enabled chains from zetacore")
return err
}
// hotfix-v19.0.1: hardcode blockHeaderEnabledChains to empty because the zetacore API somehow won't work
blockHeaderEnabledChains := []lightclienttypes.HeaderSupportedChain{}

// blockHeaderEnabledChains, err := c.GetBlockHeaderEnabledChains(ctx)
// if err != nil {
// c.logger.Info().Msg("Unable to fetch block header enabled chains from zetacore")
// return err
// }

appContext.Update(
keyGen,
Expand Down
29 changes: 15 additions & 14 deletions zetaclient/zetacore/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,21 @@ func TestZetacore_UpdateAppContext(t *testing.T) {
GasPriceIncreaseFlags: nil,
}})

method = "/zetachain.zetacore.lightclient.Query/HeaderEnabledChains"
s.ExpectUnary(method).
UnlimitedTimes().
WithPayload(lightclienttypes.QueryHeaderEnabledChainsRequest{}).
Return(lightclienttypes.QueryHeaderEnabledChainsResponse{HeaderEnabledChains: []lightclienttypes.HeaderSupportedChain{
{
ChainId: chains.Ethereum.ChainId,
Enabled: true,
},
{
ChainId: chains.BitcoinMainnet.ChainId,
Enabled: false,
},
}})
// hotfix-v19.0.1: hardcode blockHeaderEnabledChains to empty
// method = "/zetachain.zetacore.lightclient.Query/HeaderEnabledChains"
// s.ExpectUnary(method).
// UnlimitedTimes().
// WithPayload(lightclienttypes.QueryHeaderEnabledChainsRequest{}).
// Return(lightclienttypes.QueryHeaderEnabledChainsResponse{HeaderEnabledChains: []lightclienttypes.HeaderSupportedChain{
// {
// ChainId: chains.Ethereum.ChainId,
// Enabled: true,
// },
// {
// ChainId: chains.BitcoinMainnet.ChainId,
// Enabled: false,
// },
// }})

method = "/zetachain.zetacore.authority.Query/ChainInfo"
s.ExpectUnary(method).
Expand Down

0 comments on commit 43a78ef

Please sign in to comment.