Skip to content

Commit

Permalink
[ECO-2784] Add arena events to the broker, update subscription model …
Browse files Browse the repository at this point in the history
…and README to support `arena` (#565)

[ECO-2785] Update event types across the SDK and frontend to support broker-emitted arena events (#566)

[ECO-2786] Add e2e tests for all arena websocket events except `Melee` events (#567)

[ECO-2789] Update the broker image version for the `alpha` stack to use `5.0.1`: arena event emission support (#568)

[ECO-2664] Add home page arena update (#508)

Co-authored-by: Matt <[email protected]>

[ECO-2588] Add market page banner and navigation link to arena (#512)

Co-authored-by: Matt <[email protected]>

[ECO-2802] Fix minor import issue (#576)

[ECO-2807] Have the `deployer` service start a very short arena; add tests to set next melee duration (#579)

[ECO-2812] Kill stacks (#586)

[ECO-2809] Restrict number of lines changed in a PR (#582)

[ECO-2816] Deploy arena stack (#590)

[ECO-2801] Attempt to properly rebase arena feature branch (#575)

Co-authored-by: Bogdan Crisan <[email protected]>

[ECO-2815] Update SDK according to processor changes (#589)

[ECO-2828] Add shadcn styles to `global.css` for prototyping (#593)

[ECO-2811] Bump processor submodule; add/separate SDK test commands for arena; change skip to page; add arena routes to `ROUTES` (#585)

ci(ECO-2840): Add conventional commit check (#607)

feat(ECO-2837): Add configurable arena indexing (#608)

ci(ECO-2482): Disable submodule check when PR not to main (#610)

chore(ECO-2843): Update stack deploy files (#611)

fix(ECO-2845): Don't try to parse user agent string if it's empty (#613)

chore(ECO-2844): Revive stack deploy files (#612)

fix(ECO-2846): Remove the blur on hover effect for performance and UX reasons (#614)

chore(ECO-2847): Remove disabling arena indexing override (#616)

[ECO-2813] Add a `/test-utils` page for updating arena state on a local network; add shadcn for prototyping components (#587)

test(ECO-2808): Add E2E tests for arena processor refactor (#581)

Co-authored-by: Matt <[email protected]>

chore(ECO-2851): Clean up `PrivateChart.tsx` and make the inner logic more modular (#618)

[ECO-2826] Add happy path indexer testing for enter, swap, and exit (#591)

Co-authored-by: Matt <[email protected]>

fix(ECO-2853):  Fix object comparison in e2e tests that accidentally got merged (#621)

test(ECO-2827): Add arena leaderboard testing (#592)

Co-authored-by: Matt <[email protected]>

ci(ECO-2855): Add GitHub actions merge queue support (#622)

docs(ECO-2860): Document emojicoin arena audit (#625)

ci(ECO-2870): Update docs site build to run each PR (#627)

fix(ECO-2848): Update `next.config.mjs` `experimental.staleTimes` to remove opinionated default caching behavior (#617)

chore(ECO-2880): Simplify PR template for conventional commits (#631)

test(ECO-2887): Update loop test declaration per Aptos Labs guidance (#632)

chore(ECO-2875): Miscellaneous clean-up and stylistic fixes for consistency (#630)

chore(ECO-2889): Kill `arena` stack in preparation for cold upgrade (#634)

chore(ECO-2891): Revive `arena` stack with `v6.0.0-alpha.1` versions (#635)

chore(ECO-2857): Update SDK to match new processor fields (#624)

Co-authored-by: Matt <[email protected]>

chore(ECO-2888): Bump arena `processor` submodule to `v6.0.0-alpha.1`; build corresponding new `broker` image (#633)

test(ECO-2835): Test leaderboard exit status (#605)

Co-authored-by: Matt <[email protected]>

test(ECO-2862): Add missing test cases for arena processing (#626)

Co-authored-by: Matt <[email protected]>

feat(ECO-2876): Add arena candlesticks to SDK (#640)

Co-authored-by: Matt <[email protected]>

chore(ECO-2956): Prepare the `alpha` stack for revival by killing it (#670)

chore(ECO-2957): Revive the `alpha` stack with `6.0.0` (#671)
  • Loading branch information
xbtmatt committed Mar 5, 2025
1 parent cdbd708 commit 62e7e70
Show file tree
Hide file tree
Showing 139 changed files with 7,697 additions and 1,164 deletions.
11 changes: 2 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,5 @@ this PR.

# Checklist

- [ ] Did you update relevant documentation?
- [ ] Did you add tests to cover new code or a fixed issue?
- [ ] Did you update the changelog?
- [ ] Did you check all checkboxes from the linked Linear task?

<!--
If a checklist item does not apply to your PR,
please delete the corresponding line.
-->
- [ ] Did you check all checkboxes from the linked Linear task? (Ignore if you
are not a member of Econia Labs)
135 changes: 135 additions & 0 deletions .github/workflows/check-n-lines-changed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
MAX_LINES_ADDED: 300
MAX_LINES_REMOVED: 500
OVERRIDE_N_APPROVALS: 2
jobs:
check-n-lines-changed:
env:
# If run from a merge group, the action should not run. However there is
# no way to exit early in GitHub actions per
# https://github.com/actions/runner/issues/662, so using a conditional
# check for each step serves as a workaround.
IS_MERGE_GROUP: '${{ github.event_name == ''merge_group'' }}'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- id: 'get-pr-number'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Get PR number'
# yamllint disable rule:indentation
run: |
PR_NUMBER=$(
if [ "${{ github.event_name }}" = "pull_request_review" ]; then
echo "${{ github.event.pull_request.number }}"
else
echo "${{ github.event.pull_request.number }}"
fi
)
if [ -z "$PR_NUMBER" ]; then
echo "No PR number found. Exiting."
exit 1
fi
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
# yamllint enable rule:indentation
- id: 'get-base-branch'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Get PR base branch'
run: |
PR_NUMBER="${{ steps.get-pr-number.outputs.number }}"
BASE=$(gh pr view "$PR_NUMBER" --json baseRefName -q '.baseRefName')
echo "Base branch: $BASE"
echo "base_branch=$BASE" >> $GITHUB_OUTPUT
- id: 'get-insertions'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Get number of lines added'
# yamllint disable rule:indentation
run: |
BASE_BRANCH="${{ steps.get-base-branch.outputs.base_branch }}"
git fetch origin $BASE_BRANCH
INSERTIONS=$(
git diff --stat origin/$BASE_BRANCH | \
tail -n1 | grep -oP '\d+(?= insertion)' || echo "0"
)
echo "Number of lines added: $INSERTIONS"
echo "insertions=$INSERTIONS" >> $GITHUB_OUTPUT
# yamllint enable rule:indentation
- id: 'get-deletions'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Get number of lines removed'
# yamllint disable rule:indentation
run: |
BASE_BRANCH="${{ steps.get-base-branch.outputs.base_branch }}"
git fetch origin $BASE_BRANCH
DELETIONS=$(
git diff --stat origin/$BASE_BRANCH | \
tail -n1 | grep -oP '\d+(?= deletion)' || echo "0"
)
echo "Number of lines removed: $DELETIONS"
echo "deletions=$DELETIONS" >> $GITHUB_OUTPUT
# yamllint enable rule:indentation
- id: 'get-approvals'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Get number of active approving reviews'
# Sum up the number of approvals across all reviewers, only counting a
# review as approving if it is the last review by that reviewer.
# yamllint disable rule:indentation
run: |
APPROVALS=$(
gh pr view ${{ steps.get-pr-number.outputs.number }} \
--json reviews | \
jq '
.reviews
| group_by(.user.login)
| map(last)
| map(select(.state == "APPROVED"))
| length
'
)
echo "Number of approvals: $APPROVALS"
echo "approvals=$APPROVALS" >> $GITHUB_OUTPUT
# yamllint enable rule:indentation
- if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
name: 'Check size versus approvals'
# yamllint disable rule:indentation
run: |
INSERTIONS="${{ steps.get-insertions.outputs.insertions }}"
DELETIONS="${{ steps.get-deletions.outputs.deletions }}"
echo "$INSERTIONS lines added (max ${{ env.MAX_LINES_ADDED }})"
echo "$DELETIONS lines removed (max ${{ env.MAX_LINES_REMOVED }})"
NEEDS_OVERRIDE="false"
if [ "$INSERTIONS" -gt "${{ env.MAX_LINES_ADDED }}" ]; then
NEEDS_OVERRIDE="true"
fi
if [ "$DELETIONS" -gt "${{ env.MAX_LINES_REMOVED }}" ]; then
NEEDS_OVERRIDE="true"
fi
if [ "$NEEDS_OVERRIDE" = "true" ]; then
APPROVALS="${{ steps.get-approvals.outputs.approvals }}"
OVERRIDE_N_APPROVALS="${{ env.OVERRIDE_N_APPROVALS }}"
if [ "$APPROVALS" -ge "$OVERRIDE_N_APPROVALS" ]; then
echo "✅ Changes exceeded limits but have required approvals"
else
echo "❌ Too many changes. Need $OVERRIDE_N_APPROVALS approvals"
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "If the PR author hasn't updated this PR since enough"
echo "approvals were left, you must manually trigger a re-run"
fi
exit 1
fi
else
echo "✅ Changes within limits"
fi
# yamllint enable rule:indentation
name: 'Check number of lines changed'
'on':
merge_group: null
pull_request:
branches-ignore:
- 'production'
- 'fallback'
pull_request_review: null
...
34 changes: 34 additions & 0 deletions .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# cspell:word amannn
---
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
jobs:
conventional-commit:
env:
# If run from a merge group, the action should not run. However there is
# no way to exit early in GitHub actions per
# https://github.com/actions/runner/issues/662, so using a conditional
# check for each step serves as a workaround.
IS_MERGE_GROUP: '${{ github.event_name == ''merge_group'' }}'
runs-on: 'ubuntu-latest'
steps:
- env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
if: '${{ env.IS_MERGE_GROUP != ''true'' }}'
uses: 'amannn/action-semantic-pull-request@v5'
with:
requireScope: true
scopes: '^ECO-[0-9]+$'
subjectPattern: '^[A-Z].*$'
validateSingleCommit: true
validateSingleCommitMatchesPrTitle: true
name: 'Verify conventional commit PR title'
'on':
merge_group: null
pull_request:
types:
- 'edited'
- 'opened'
- 'reopened'
- 'synchronize'
...
1 change: 1 addition & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
extra_args: '--all-files --config cfg/pre-commit-config.yaml'
name: 'pre-commit'
'on':
merge_group: null
pull_request: null
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sdk-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
timeout-minutes: 15
name: 'Run the SDK tests'
'on':
merge_group: null
pull_request: null
push:
branches:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/submodule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
working-directory: 'src/rust/processor'
name: 'Ensure correct version of processor submodule'
'on':
pull_request: null
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/verify-doc-site-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ jobs:
- run: 'pnpm build'
name: 'Verify docs site build'
'on':
pull_request:
branches:
- 'main'
- 'production'
paths:
- 'doc/doc-site/**'
- '.github/workflows/verify-doc-site-build.yaml'
merge_group: null
pull_request: null
workflow_dispatch: null
...
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

*Sponsored by a grant from the Aptos Foundation*

The emojicoin dot fun Move package is audited:
The emojicoin dot fun and emojicoin arena Move packages are audited:

- [PDF Report]
- Corresponding `git` tag [`move-v1.0.1-audited`]
- `git` tag [`move-v1.0.1-audited`]
- `git` tag [`arena-move-v1.0.0-audited`]

<!-- markdownlint-enable MD036 -->

Expand Down Expand Up @@ -199,4 +200,5 @@ git submodule update --init --recursive
[pre-commit shield]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit
[uploading environment variables with vercel's ui]: https://github.com/user-attachments/assets/d613725d-82ed-4a4e-a467-a89b2cf57d91
[vercel cli]: https://vercel.com/docs/cli
[`arena-move-v1.0.0-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/arena-move-v1.0.0-audited
[`move-v1.0.1-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/move-v1.0.1-audited
1 change: 1 addition & 0 deletions cfg/cspell-frontend-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ bytea
nominalize
dexscreener
clippyts
xlarge
6 changes: 4 additions & 2 deletions doc/doc-site/docs/resources/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ title: 🧑‍💻 Audit
hide_title: false
---

The emojicoin dot fun Move package is audited:
The `emojicoin dot fun` and `emojicoin arena` Move packages are audited:

- [PDF Report]
- Corresponding `git` tag [`move-v1.0.1-audited`]
- `git` tag [`move-v1.0.1-audited`]
- `git` tag [`arena-move-v1.0.0-audited`]

[pdf report]: https://econia-labs.notion.site/emojicoin-dot-fun-audit-8806ffea2b594c8e846ce3d32e5630b9
[`arena-move-v1.0.0-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/arena-move-v1.0.0-audited
[`move-v1.0.1-audited`]: https://github.com/econia-labs/emojicoin-dot-fun/releases/tag/move-v1.0.1-audited
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"test:frontend": "pnpm --prefix src/typescript run test:frontend",
"test:frontend:e2e": "pnpm --prefix src/typescript run test:frontend:e2e",
"test:sdk": "pnpm --prefix src/typescript run test:sdk",
"test:sdk:arena": "pnpm --prefix src/typescript run test:sdk:arena",
"test:sdk:e2e": "pnpm --prefix src/typescript run test:sdk:e2e",
"test:sdk:unit": "pnpm --prefix src/typescript run test:sdk:unit",
"test:verbose": "pnpm --prefix src/typescript run test:verbose",
Expand Down
4 changes: 2 additions & 2 deletions src/cloud-formation/deploy-indexer-alpha.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
parameters:
BrokerImageVersion: '5.0.0'
BrokerImageVersion: '6.0.0'
DeployAlb: 'true'
DeployAlbDnsRecord: 'true'
DeployBastionHost: 'true'
Expand All @@ -20,7 +20,7 @@ parameters:
Environment: 'alpha'
Network: 'testnet'
ProcessorHealthCheckStartPeriod: 300
ProcessorImageVersion: '5.0.0'
ProcessorImageVersion: '6.0.0'
VpcStackName: 'emoji-vpc'
tags: null
template-file-path: 'src/cloud-formation/indexer.cfn.yaml'
Expand Down
18 changes: 15 additions & 3 deletions src/cloud-formation/indexer.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Conditions:
EnableWafRulesWebSocket: !Equals
- !Ref 'EnableWafRulesWebSocket'
- 'true'
IndexArena: !Equals
- !Ref 'IndexArena'
- 'true'
Mappings:
Constants:
# These compromised credentials are not a security risk because access to
Expand Down Expand Up @@ -203,6 +206,12 @@ Parameters:
Type: 'String'
Environment:
Type: 'String'
IndexArena:
AllowedValues:
- 'false'
- 'true'
Default: 'true'
Type: 'String'
Network:
AllowedValues:
- 'mainnet'
Expand Down Expand Up @@ -1418,9 +1427,12 @@ Resources:
- Name: 'EMOJICOIN_MODULE_ADDRESS'
Value: !Sub
'{{resolve:ssm:/emojicoin/package-address/${Network}}}'
- Name: 'EMOJICOIN_ARENA_MODULE_ADDRESS'
Value: !Sub
'{{resolve:ssm:/emojicoin/arena-package-address/${Network}}}'
- !If
- 'IndexArena'
- Name: 'EMOJICOIN_ARENA_MODULE_ADDRESS'
Value: !Sub
'{{resolve:ssm:/emojicoin/arena-package-address/${Network}}}'
- !Ref 'AWS::NoValue'
- Name: 'WS_PORT'
Value: !FindInMap
- 'Constants'
Expand Down
4 changes: 2 additions & 2 deletions src/docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
PROCESSOR_WS_URL: 'ws://processor:${PROCESSOR_WS_PORT}/ws'
PORT: '${BROKER_PORT}'
RUST_LOG: 'info,broker=trace'
image: 'econialabs/emojicoin-dot-fun-indexer-broker'
image: 'econialabs/emojicoin-dot-fun-indexer-broker:6.0.0'
container_name: 'broker'
healthcheck:
test: 'curl -f http://localhost:${BROKER_PORT}/live || exit 1'
Expand Down Expand Up @@ -83,7 +83,7 @@ services:
depends_on:
postgres:
condition: 'service_healthy'
image: 'econialabs/emojicoin-dot-fun-indexer-processor'
image: 'econialabs/emojicoin-dot-fun-indexer-processor:6.0.0'
container_name: 'processor'
healthcheck:
test: 'curl -sf http://localhost:${PROCESSOR_WS_PORT} || exit 1'
Expand Down
22 changes: 22 additions & 0 deletions src/docker/deployer/sh/build-publish-payloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ aptos move build-publish-payload \
--json-output-file $json_dir/market_metadata.json \
--skip-fetch-latest-git-deps

# Ensure the default duration const is in the source file exactly as expected.
original_const="const DEFAULT_DURATION: u64 = 20 \* 3_600_000_000;"
source_file="$move_dir/emojicoin_arena/sources/emojicoin_arena.move"

# Ensure there's exactly 1 appearance in the source code.
if [ $(grep -c "$original_const" "$source_file") -ne 1 ]; then
log_error "Couldn't find constant DEFAULT_DURATION in the arena move code."
exit 1
fi

# Replace the default duration with 1 microsecond.
# Instead of trying to finagle setting the value here, just set the first
# one to be really short, and let the test suite set the next melee duration
# and end the first melee immediately.
replacement_const="const DEFAULT_DURATION: u64 = 1;"
sed -i "s/${original_const}/${replacement_const}/" "$source_file"

if [ $(grep -c "$replacement_const" "$source_file") -ne 1 ]; then
log_error "Couldn't replace the DEFAULT_DURATION value."
exit 1
fi

aptos move build-publish-payload \
--assume-yes \
--named-addresses \
Expand Down
Loading

0 comments on commit 62e7e70

Please sign in to comment.