Skip to content

Conversation

@0xKrishna
Copy link
Contributor

No description provided.

@0xKrishna 0xKrishna marked this pull request as ready for review December 14, 2025 18:08
@0xKrishna 0xKrishna requested review from 0xaigen and JekaMas December 30, 2025 16:54
// Run starts the appchain with the given config. Exported for testing.
func Run(ctx context.Context, cfg *gosdk.InitConfig) error {
// Add custom tables to config
cfg.CustomTables = application.Tables()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future we need to change it, like adding a method RegisterTables or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

}

// Run appchain in goroutine
runErr := make(chan error, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats about graceful shutdown in the uodated version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signal.NotifyContext above still handles that, It will cancel the ctx
runErr chan was never actually read
Now graceful shutdown is handled via ctx propagation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, it's not a magic thing. you have to have select that listens the context and run the app in a goroutine to make it work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a select inside Run which is listening to ctx in loop, Will that not work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me update, Got it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check now, I have added for app and rpc both

select {
case <-ctx.Done():
// nothing to do
case runErr <- appchainExample.Run(ctx):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we removed that and made the app blocking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me add stop() when appchain crashes, Rest cases are handled by ctx propagation


// craft os.Args for main()
oldArgs := os.Args
require.NoError(t, os.MkdirAll(txBatchPath, 0o755))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to create them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think yes because in actual pelacli creates them and appchain just consume
txBatch, events and multichain
only txpool and appchainDB is created by appchain

@@ -1,48 +1,34 @@
services:
pelacli:
container_name: pelacli
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cluster working fine? Transactions, their status?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean cluster with example and pelacli ? Or the core cluster ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are asking about local cluster with example, pelacli and explorer
It's working fine
Just need to update pelacli with latest sdk once core is done


appchainExample := gosdk.NewAppchain(
stateTransition,
defer appInit.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it intersect with dbs that appchain closes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes both close storage object but in our example we have not used appchain.close
We can remove storage.close from appchain.close in sdk

@github-actions
Copy link

Code Metrics Report

#14 (818c750) #14 (5c69771) +/-
Coverage 25.2% 25.2% -0.1%
Test Execution Time 2s 2s 0s
Details
  |                     | #14 (818c750) | #14 (5c69771) |  +/-  |
  |---------------------|---------------|---------------|-------|
- | Coverage            |         25.2% |         25.2% | -0.1% |
  |   Files             |            11 |            11 |     0 |
  |   Lines             |           336 |           337 |    +1 |
  |   Covered           |            85 |            85 |     0 |
  | Test Execution Time |            2s |            2s |    0s |

Code coverage of files in pull request scope (11.4% → 11.4%)

Files Coverage +/- Status
application/external_block_processor.go 0.8% 0.0% renamed
application/solana_payload.go 0.0% 0.0% modified
application/transaction.go 15.0% 0.0% modified
cmd/main.go 47.5% -1.3% modified

Reported by octocov

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.

4 participants