Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blueprint for starknet single node deployment #75

Merged
merged 1 commit into from
May 14, 2024

Conversation

wojciechos
Copy link
Contributor

@wojciechos wojciechos commented May 7, 2024

relates to #70

What does this PR do?

🛑 Please open an issue first to discuss any significant work and flesh out details/direction - we would hate for your time to be wasted.
Consult the CONTRIBUTING guide for submitting pull-requests.

Motivation

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

More

  • Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes)
  • Mandatory for new node blueprints. Yes, I have added usage example to the README.md file in my blueprint folder
  • Mandatory for new node blueprints. Yes, I have implemented automated tests for all stacks in my blueprint and they pass
  • Mandatory for new node blueprints. Yes, I have added a reference to my README.md file to website/docs section for this feature
  • Yes, I have set up and ran all pre-merge quality control tools on my local machine and they don't show warnings.

For Moderators

  • The tests for all current blueprints successfully complete before merge?
  • Mandatory for new node blueprints. All pre-merge quality control tools and cdk-nag tools don't show warnings?
  • Mandatory for new node blueprints. The deployment test works on blank AWS account according to instructions in the README.md before merge?
  • Mandatory for new node blueprints. The website builds without errors?

Additional Notes

Logs from local account setup

npx cdk deploy starknet-single-node --profile nethermind --json --outputs-file single-node-deploy.json --output test

✨  Synthesis time: 81.51s

starknet-single-node:  start: Building 75acd05b45be7a87cb7858dc891d1f352f4d77059af27609e6ad02475d060975:529535165027-us-east-1
starknet-single-node:  success: Built 75acd05b45be7a87cb7858dc891d1f352f4d77059af27609e6ad02475d060975:529535165027-us-east-1
starknet-single-node:  start: Building 5eca692d774e1928de8af7d0c40a29884a5c97544d23d48886a0992503468671:529535165027-us-east-1
starknet-single-node:  success: Built 5eca692d774e1928de8af7d0c40a29884a5c97544d23d48886a0992503468671:529535165027-us-east-1
starknet-single-node:  start: Publishing 75acd05b45be7a87cb7858dc891d1f352f4d77059af27609e6ad02475d060975:529535165027-us-east-1
starknet-single-node:  start: Publishing 5eca692d774e1928de8af7d0c40a29884a5c97544d23d48886a0992503468671:529535165027-us-east-1
starknet-single-node:  success: Published 75acd05b45be7a87cb7858dc891d1f352f4d77059af27609e6ad02475d060975:529535165027-us-east-1
starknet-single-node:  success: Published 5eca692d774e1928de8af7d0c40a29884a5c97544d23d48886a0992503468671:529535165027-us-east-1
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
┌───┬───────────────────────────────────────────────┬────────┬───────────────────────────────────────────────┬────────────────────────────────────────────────┬───────────┐
│   │ Resource                                      │ Effect │ Action                                        │ Principal                                      │ Condition │
├───┼───────────────────────────────────────────────┼────────┼───────────────────────────────────────────────┼────────────────────────────────────────────────┼───────────┤
│ + │ arn:aws:s3:::cdk-hnb659fds-assets-52953516502 │ Allow  │ s3:GetBucket*                                 │ AWS:{"Fn::Select":[1,"{\"Fn::Split\":[\"/\",\" │           │
│   │ 7-us-east-1                                   │        │ s3:GetObject*                                 │ {\\\"Fn::Select\\\":[5,\\\"{\\\\\\\"Fn::Split\ │           │
│   │ arn:aws:s3:::cdk-hnb659fds-assets-52953516502 │        │ s3:List*                                      │ \\\\\\":[\\\\\\\":\\\\\\\",\\\\\\\"{\\\\\\\\\\ │           │
│   │ 7-us-east-1/*                                 │        │                                               │ \\\\\"Fn::ImportValue\\\\\\\\\\\\\\\":\\\\\\\\ │           │
│   │                                               │        │                                               │ \\\\\\\"StarknetNodeInstanceRoleArn\\\\\\\\\\\ │           │
│   │                                               │        │                                               │ \\\\"}\\\\\\\"]}\\\"]}\"]}"]}                  │           │
└───┴───────────────────────────────────────────────┴────────┴───────────────────────────────────────────────┴────────────────────────────────────────────────┴───────────┘
Security Group Changes
┌───┬───────────────────────────────────────────────────┬─────┬────────────┬─────────────────┐
│   │ Group                                             │ Dir │ Protocol   │ Peer            │
├───┼───────────────────────────────────────────────────┼─────┼────────────┼─────────────────┤
│ + │ ${security-group/rpc-node-security-group.GroupId} │ In  │ TCP 6060   │ 172.31.0.0/16   │
│ + │ ${security-group/rpc-node-security-group.GroupId} │ Out │ Everything │ Everyone (IPv4) │
└───┴───────────────────────────────────────────────────┴─────┴────────────┴─────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y
starknet-single-node: deploying... [1/1]
starknet-single-node: creating CloudFormation changeset...

 ✅  starknet-single-node

✨  Deployment time: 255.34s

Outputs:
starknet-single-node.nodeinstanceid = i-062964902d40df3e4
Stack ARN:
arn:aws:cloudformation:us-east-1:529535165027:stack/starknet-single-node/c0884bd0-0c66-11ef-aadc-0edfc94f3059

✨  Total time: 336.85s

Tests

 PASS  ./starknet-single-node.test.ts (12.869 s)
  StarknetSingleNodeStack
    √ Check Security Group (4 ms)
    √ Check EC2 Settings (3 ms)
    √ Check CloudWatch Dashboard (1 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        13.203 s

RPC Usage on ec2:

$ curl --location 'http://localhost:6060' \
--header 'Content-Type: application/json' \
--data '{
        "jsonrpc":"2.0",
        "method":"starknet_syncing",
        "params":[],
        "id":1
}'> > > > > > >
{"jsonrpc":"2.0","result":{"starting_block_hash":"0x47c3637b57c2b079b93c61539950c17e868a28f46cdef28f88521067f21e943","starting_block_num":0,"current_block_hash":"0x6ccc577b1c885a5607a2216fc821555c0e9f71db80b49ca9debaa714adc7d6","current_block_num":511,"highest_block_hash":"0x6d5cef60840e5b0b4ba74957a6e4e1ba78551095662a57fcec2877e5e465e77","highest_block_num":638644},"id":1}$

@frbrkoala frbrkoala changed the base branch from main to starknet May 14, 2024 08:33
@frbrkoala
Copy link
Contributor

Thank you for your contribution! I'm merging this PR to a new branch and will go ahead with end-to-end testing and check possible integration with Amazon Managed Blockchain Access for Ethereum node as an option for L1. Will also re-run the code scanning tools and integrate the documentation into the website. Give me 3-4 days to complete the testing.

@frbrkoala frbrkoala merged commit 6683c9f into aws-samples:starknet May 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants