Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Oct 18, 2024
1 parent 6d11768 commit d09ae2a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 30 deletions.
34 changes: 5 additions & 29 deletions .github/workflows/release-relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: release-relayer

on:
push:
paths:
- "relayer/**"
branches:
- main
- more-logs
workflow_dispatch:

env:
Expand Down Expand Up @@ -60,43 +59,20 @@ jobs:
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Determine new version
id: new_version
run: |
# Get the most recent tag in the format relayer-v<version>
current_tag=$(git tag --list "relayer-v*" --sort=-v:refname | head -n 1)
current_version=$(git tag --list "relayer-v*" --sort=-v:refname | head -n 1 | sed -E 's/relayer-v//')
echo "Current version: $current_version"
# If there is no current version, set it to 1.0.0
if [ -z "$current_version" ]; then
new_version="1.0.0"
else
new_version=$(npx semver $current_version -i patch)
fi
echo "New version: $new_version"
echo "version=$new_version" >> $GITHUB_OUTPUT
echo "from_tag=$current_tag" >> $GITHUB_OUTPUT
- name: Create new tag
id: create_tag
run: |
tag_name="relayer-v${{ steps.new_version.outputs.version }}"
tag_name="relayer-more-logs"
echo "Tag name: $tag_name"
echo "tag=$tag_name" >> $GITHUB_OUTPUT
git tag $tag_name
- name: Push new tag
run: |
git push origin --tags
# - name: Push new tag
# run: |
# git push origin --tags

- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
fromTag: ${{ steps.new_version.outputs.from_tag }}
toTag: ${{ steps.create_tag.outputs.tag }}

- name: Create a GitHub Release
id: create_release
Expand Down
3 changes: 3 additions & 0 deletions relayer/relays/beacon/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ func (h *Header) isInitialSyncPeriod() bool {
}

func (h *Header) findLatestCheckPoint(slot uint64) (state.FinalizedHeader, error) {
log.Debug("finding checkpoint")
var beaconState state.FinalizedHeader
lastIndex, err := h.writer.GetLastFinalizedStateIndex()
if err != nil {
Expand All @@ -558,6 +559,7 @@ func (h *Header) findLatestCheckPoint(slot uint64) (state.FinalizedHeader, error
totalStates := syncCommitteePeriod * h.protocol.HeaderRedundancy // Total size of the circular buffer,
// https://github.com/paritytech/polkadot-sdk/blob/master/bridges/snowbridge/pallets/ethereum-client/src/lib.rs#L75
for index := startIndex; index != endIndex; index = (index - 1 + totalStates) % totalStates {
log.WithField("index", index).Debug("looking up checkpoint")
beaconRoot, err := h.writer.GetFinalizedBeaconRootByIndex(uint32(index))
if err != nil {
return beaconState, fmt.Errorf("GetFinalizedBeaconRootByIndex %d, error: %w", index, err)
Expand All @@ -575,6 +577,7 @@ func (h *Header) findLatestCheckPoint(slot uint64) (state.FinalizedHeader, error
}
// Found the beaconState
if beaconState.BeaconSlot > slot && beaconState.BeaconSlot < slot+syncCommitteePeriod {
log.Debug("found checkpoint")
return beaconState, nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion relayer/relays/beacon/header/syncer/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func (b *BeaconClient) GetBeaconState(stateIdOrSlot string) ([]byte, error) {
res, err := b.httpClient.Do(req)
endTime := time.Now()
duration := endTime.Sub(startTime)
log.WithFields(log.Fields{"startTime": startTime.Format(time.UnixDate), "endTime": endTime.Format(time.UnixDate), "duration": duration.Seconds()}).Warn("beacon state download time")
log.WithFields(log.Fields{"startTime": startTime.Format(time.UnixDate), "endTime": endTime.Format(time.UnixDate), "duration": duration.Seconds()}).Info("beacon state download time")

if err != nil {
return data, err
Expand Down
2 changes: 2 additions & 0 deletions relayer/relays/execution/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ func (r *Relay) doSubmit(ctx context.Context, ev *contracts.GatewayOutboundMessa
return fmt.Errorf("get block header: %w", err)
}

log.Debug("fetching beacon proofs")
// ParentBeaconRoot in https://eips.ethereum.org/EIPS/eip-4788 from Deneb onward
proof, err := r.beaconHeader.FetchExecutionProof(*blockHeader.ParentBeaconRoot, r.config.InstantVerification)
log.Debug("finished fetching beacon proofs")
if errors.Is(err, header.ErrBeaconHeaderNotFinalized) {
return err
}
Expand Down

0 comments on commit d09ae2a

Please sign in to comment.