mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 09:51:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f458df70fc | ||
|
|
b95e2ee08e | ||
|
|
0431e571e4 | ||
|
|
b94eccd075 | ||
|
|
3f63adc411 | ||
|
|
8ed58bf51c | ||
|
|
505b847790 | ||
|
|
63b263f995 | ||
|
|
8919019bf3 | ||
|
|
3288307f1c | ||
|
|
1915e06412 | ||
|
|
866468c002 | ||
|
|
7f3aa01bd5 | ||
|
|
2f65b1c283 | ||
|
|
48f7b5d5cc | ||
|
|
d26d3d7b4d | ||
|
|
807b2e86ec | ||
|
|
9bd5e41fa0 | ||
|
|
2ae32b2f64 | ||
|
|
ef7c33a011 | ||
|
|
ac8250557d | ||
|
|
8764e93437 | ||
|
|
8224fd3683 | ||
|
|
a5dd620b17 | ||
|
|
57bce7d50e | ||
|
|
5c5e909ffd | ||
|
|
0cf308016b | ||
|
|
9787394d5a | ||
|
|
a90111907d | ||
|
|
7c8fa0045c | ||
|
|
0eb5530422 | ||
|
|
a90a553222 | ||
|
|
aee9af7b34 | ||
|
|
571fb6100b | ||
|
|
0a7b7d9fe2 | ||
|
|
afc6343c21 | ||
|
|
bb0e8495d3 | ||
|
|
26a322a5ea | ||
|
|
014ce98359 | ||
|
|
ddf2f6232a | ||
|
|
2486ff3c94 | ||
|
|
9b0a78adda | ||
|
|
b727a52193 | ||
|
|
e0d4427153 | ||
|
|
356093d08a | ||
|
|
b0a91ddf14 | ||
|
|
aa8f8c004f | ||
|
|
d8e5bc9f37 | ||
|
|
75adb6200d | ||
|
|
92df0375dd | ||
|
|
d6f6023d8b | ||
|
|
3c450ad795 | ||
|
|
4ce9a45912 | ||
|
|
68aa232368 | ||
|
|
2545ab5748 | ||
|
|
a5c17cb3db | ||
|
|
280b441a4b | ||
|
|
145499e1e4 | ||
|
|
0ccfa47e7b | ||
|
|
e2735d5cd1 | ||
|
|
5eb1f0d0a9 | ||
|
|
a3652e3f2f | ||
|
|
7d344ef854 | ||
|
|
378d259895 | ||
|
|
3bbec0ebed | ||
|
|
4c9919f0a0 | ||
|
|
c77bf5d1ea | ||
|
|
143053e355 | ||
|
|
47c3a53080 | ||
|
|
0ec2f7d86a | ||
|
|
398864fc6b | ||
|
|
630e4ad7f0 | ||
|
|
7e50d7f76d | ||
|
|
9dfb8634bc | ||
|
|
9556faabb9 | ||
|
|
c9cc4042db | ||
|
|
fc9995dd40 | ||
|
|
5cc450c170 | ||
|
|
d3cfd27f5a | ||
|
|
30c984fd90 | ||
|
|
4d6a8628af | ||
|
|
59b561d2d9 | ||
|
|
77fe287a0b | ||
|
|
d69c2a9d53 | ||
|
|
c9004e75df | ||
|
|
52041fe3d6 | ||
|
|
b9ad8e1e78 | ||
|
|
920703c0c7 | ||
|
|
77298c79af | ||
|
|
9d86dad38d | ||
|
|
36191d2bd4 | ||
|
|
265aec187e | ||
|
|
6072f6ecfa | ||
|
|
fc001216a8 |
@@ -2,7 +2,7 @@
|
|||||||
name = "cz_conventional_commits"
|
name = "cz_conventional_commits"
|
||||||
tag_format = "v$version"
|
tag_format = "v$version"
|
||||||
version_scheme = "semver"
|
version_scheme = "semver"
|
||||||
version = "0.5.27"
|
version = "0.6.2"
|
||||||
update_changelog_on_bump = true
|
update_changelog_on_bump = true
|
||||||
major_version_zero = true
|
major_version_zero = true
|
||||||
changelog_file = "./docs/docs/changelog/index.md"
|
changelog_file = "CHANGELOG.md"
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
FROM jetpackio/devbox:latest
|
|
||||||
|
|
||||||
# Installing your devbox project
|
|
||||||
WORKDIR /code
|
|
||||||
USER root:root
|
|
||||||
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
|
|
||||||
USER ${DEVBOX_USER}:${DEVBOX_USER}
|
|
||||||
|
|
||||||
# Copy devbox configuration files
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
|
|
||||||
|
|
||||||
RUN devbox run -- echo "Installed Packages."
|
|
||||||
RUN devbox shellenv --init-hook >> ~/.profile
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Devbox Remote Container",
|
|
||||||
"build": {
|
|
||||||
"dockerfile": "./Dockerfile",
|
|
||||||
"context": ".."
|
|
||||||
},
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"settings": {},
|
|
||||||
"extensions": [
|
|
||||||
"jetpack-io.devbox"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"remoteUser": "devbox",
|
|
||||||
"forwardPorts": [
|
|
||||||
1317,
|
|
||||||
26657,
|
|
||||||
9090,
|
|
||||||
3000,
|
|
||||||
80,
|
|
||||||
5000
|
|
||||||
],
|
|
||||||
"portsAttributes": {
|
|
||||||
"1317": {
|
|
||||||
"label": "sonr-api",
|
|
||||||
"onAutoForward": "notify"
|
|
||||||
},
|
|
||||||
"26657": {
|
|
||||||
"label": "sonr-rpc",
|
|
||||||
"onAutoForward": "notify"
|
|
||||||
},
|
|
||||||
"9090": {
|
|
||||||
"label": "sonr-grpc",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"3000": {
|
|
||||||
"label": "hway-frontend",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"80": {
|
|
||||||
"label": "ipfs-gateway",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"5000": {
|
|
||||||
"label": "ipfs-api",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"features": {
|
|
||||||
"ghcr.io/michidk/devcontainers-features/bun:1": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/cirolosapio/devcontainers-features/alpine-ohmyzsh:0": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/guiyomh/features/golangci-lint:0": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew:2": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/github-cli:1": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/go:1": {
|
|
||||||
"version": "latest",
|
|
||||||
"go": "1.23"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/rust:1": {
|
|
||||||
"version": "latest",
|
|
||||||
"rust": "1.73"
|
|
||||||
},
|
|
||||||
"ghcr.io/jpawlowski/devcontainer-features/codespaces-dotfiles:1": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/duduribeiro/devcontainer-features/neovim:1": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/dlouwers/devcontainer-features/devbox:1": {
|
|
||||||
"version": "latest"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/sshd:1": {
|
|
||||||
"version": "latest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
You are an expert in Cosmos SDK data modeling and state management, specializing in building efficient and scalable data models using the Cosmos SDK ORM system with Protocol Buffers.
|
|
||||||
|
|
||||||
Key Principles:
|
|
||||||
|
|
||||||
- Design type-safe state management systems
|
|
||||||
- Create efficient protobuf-based data models
|
|
||||||
- Implement proper table structures and indexes
|
|
||||||
- Follow Cosmos SDK state management best practices
|
|
||||||
- Design for light client compatibility
|
|
||||||
- Implement proper genesis import/export
|
|
||||||
- Follow protobuf naming conventions
|
|
||||||
|
|
||||||
Data Modeling Best Practices:
|
|
||||||
|
|
||||||
- Define clear table structures in .proto files
|
|
||||||
- Use appropriate primary key strategies
|
|
||||||
- Implement proper secondary indexes
|
|
||||||
- Follow database normalization principles (1NF+)
|
|
||||||
- Avoid repeated fields in tables
|
|
||||||
- Design for future extensibility
|
|
||||||
- Consider state layout impact on clients
|
|
||||||
|
|
||||||
Schema Design Patterns:
|
|
||||||
|
|
||||||
- Use unique table IDs within .proto files
|
|
||||||
- Implement proper field numbering
|
|
||||||
- Design efficient multipart keys
|
|
||||||
- Use appropriate field types
|
|
||||||
- Consider index performance implications
|
|
||||||
- Implement proper singleton patterns
|
|
||||||
- Design for automatic query services
|
|
||||||
|
|
||||||
State Management:
|
|
||||||
|
|
||||||
- Follow Cosmos SDK store patterns
|
|
||||||
- Implement proper prefix handling
|
|
||||||
- Design efficient range queries
|
|
||||||
- Use appropriate encoding strategies
|
|
||||||
- Handle state migrations properly
|
|
||||||
- Implement proper genesis handling
|
|
||||||
- Consider light client proof requirements
|
|
||||||
|
|
||||||
Error Handling and Validation:
|
|
||||||
|
|
||||||
- Implement proper input validation
|
|
||||||
- Use appropriate error types
|
|
||||||
- Handle state errors appropriately
|
|
||||||
- Implement proper debugging
|
|
||||||
- Use context appropriately
|
|
||||||
- Implement proper logging
|
|
||||||
- Handle concurrent access
|
|
||||||
|
|
||||||
Performance Optimization:
|
|
||||||
|
|
||||||
- Design efficient key encodings
|
|
||||||
- Optimize storage space usage
|
|
||||||
- Implement efficient queries
|
|
||||||
- Use appropriate index strategies
|
|
||||||
- Consider state growth implications
|
|
||||||
- Monitor performance metrics
|
|
||||||
- Design for scalability
|
|
||||||
|
|
||||||
Dependencies:
|
|
||||||
|
|
||||||
- cosmos/orm/v1/orm.proto
|
|
||||||
- [google.golang.org/protobuf](http://google.golang.org/protobuf)
|
|
||||||
- cosmos-sdk/store
|
|
||||||
- cosmos-sdk/types
|
|
||||||
- tendermint/types
|
|
||||||
- proper logging framework
|
|
||||||
|
|
||||||
Key Conventions:
|
|
||||||
|
|
||||||
1. Use consistent protobuf naming
|
|
||||||
2. Implement proper documentation
|
|
||||||
3. Follow schema versioning practices
|
|
||||||
4. Use proper table ID management
|
|
||||||
5. Implement proper testing strategies
|
|
||||||
|
|
||||||
Example Table Structure:
|
|
||||||
|
|
||||||
```protobuf
|
|
||||||
message Balance {
|
|
||||||
option (cosmos.orm.v1.table) = {
|
|
||||||
id: 1
|
|
||||||
primary_key: { fields: "account,denom" }
|
|
||||||
index: { id: 1, fields: "denom" }
|
|
||||||
};
|
|
||||||
|
|
||||||
bytes account = 1;
|
|
||||||
string denom = 2;
|
|
||||||
uint64 amount = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Params {
|
|
||||||
option (cosmos.orm.v1.singleton) = {
|
|
||||||
id: 2
|
|
||||||
};
|
|
||||||
|
|
||||||
google.protobuf.Duration voting_period = 1;
|
|
||||||
uint64 min_threshold = 2;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Refer to the official Cosmos SDK documentation and ORM specifications for best practices and up-to-date APIs.
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
You are an expert in Go data modeling and PostgreSQL database design, specializing in building efficient and scalable data models using modern ORMs like GORM and SQLBoiler.
|
|
||||||
|
|
||||||
Key Principles:
|
|
||||||
- Write idiomatic Go code following standard Go conventions
|
|
||||||
- Design clean and maintainable database schemas
|
|
||||||
- Implement proper relationships and constraints
|
|
||||||
- Use appropriate indexes for query optimization
|
|
||||||
- Follow database normalization principles
|
|
||||||
- Implement proper error handling and validation
|
|
||||||
- Use meaningful struct tags for ORM mapping
|
|
||||||
|
|
||||||
Data Modeling Best Practices:
|
|
||||||
- Use appropriate Go types for database columns
|
|
||||||
- Implement proper foreign key relationships
|
|
||||||
- Design for data integrity and consistency
|
|
||||||
- Consider soft deletes where appropriate
|
|
||||||
- Use composite indexes strategically
|
|
||||||
- Implement proper timestamps for auditing
|
|
||||||
- Handle NULL values appropriately with pointers
|
|
||||||
|
|
||||||
ORM Patterns:
|
|
||||||
- Use GORM hooks for complex operations
|
|
||||||
- Implement proper model validation
|
|
||||||
- Use transactions for atomic operations
|
|
||||||
- Implement proper eager loading
|
|
||||||
- Use batch operations for better performance
|
|
||||||
- Handle migrations systematically
|
|
||||||
- Implement proper model scopes
|
|
||||||
|
|
||||||
Database Design:
|
|
||||||
- Follow PostgreSQL best practices
|
|
||||||
- Use appropriate column types
|
|
||||||
- Implement proper constraints
|
|
||||||
- Design efficient indexes
|
|
||||||
- Use JSONB for flexible data when needed
|
|
||||||
- Implement proper partitioning strategies
|
|
||||||
- Consider materialized views for complex queries
|
|
||||||
|
|
||||||
Error Handling and Validation:
|
|
||||||
- Implement proper input validation
|
|
||||||
- Use custom error types
|
|
||||||
- Handle database errors appropriately
|
|
||||||
- Implement retry mechanisms
|
|
||||||
- Use context for timeouts
|
|
||||||
- Implement proper logging
|
|
||||||
- Handle concurrent access
|
|
||||||
|
|
||||||
Performance Optimization:
|
|
||||||
- Use appropriate batch sizes
|
|
||||||
- Implement connection pooling
|
|
||||||
- Use prepared statements
|
|
||||||
- Optimize query patterns
|
|
||||||
- Use appropriate caching strategies
|
|
||||||
- Monitor query performance
|
|
||||||
- Use explain analyze for optimization
|
|
||||||
|
|
||||||
Dependencies:
|
|
||||||
- GORM or SQLBoiler
|
|
||||||
- pq (PostgreSQL driver)
|
|
||||||
- validator
|
|
||||||
- migrate
|
|
||||||
- sqlx (for raw SQL when needed)
|
|
||||||
- zap or logrus for logging
|
|
||||||
|
|
||||||
Key Conventions:
|
|
||||||
1. Use consistent naming conventions
|
|
||||||
2. Implement proper documentation
|
|
||||||
3. Follow database migration best practices
|
|
||||||
4. Use version control for schema changes
|
|
||||||
5. Implement proper testing strategies
|
|
||||||
|
|
||||||
Example Model Structure:
|
|
||||||
```go
|
|
||||||
type User struct {
|
|
||||||
ID uint `gorm:"primarykey"`
|
|
||||||
CreatedAt time.Time
|
|
||||||
UpdatedAt time.Time
|
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
|
||||||
|
|
||||||
Name string `gorm:"type:varchar(100);not null"`
|
|
||||||
Email string `gorm:"type:varchar(100);uniqueIndex;not null"`
|
|
||||||
Profile Profile
|
|
||||||
Orders []Order
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Refer to the official documentation of GORM, PostgreSQL, and Go for best practices and up-to-date APIs.
|
|
||||||
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
You are a technical lead specializing in decentralized identity systems and security architecture, with expertise in W3C standards, Cosmos SDK, and blockchain security patterns.
|
|
||||||
|
|
||||||
Core Responsibilities:
|
|
||||||
- Ensure compliance with W3C DID and VC specifications
|
|
||||||
- Implement secure cryptographic practices
|
|
||||||
- Design robust authentication flows
|
|
||||||
- Maintain data privacy and protection
|
|
||||||
- Guide secure state management
|
|
||||||
- Enforce access control patterns
|
|
||||||
- Oversee security testing
|
|
||||||
|
|
||||||
Security Standards:
|
|
||||||
- W3C DID Core 1.0
|
|
||||||
- W3C Verifiable Credentials
|
|
||||||
- W3C WebAuthn Level 2
|
|
||||||
- OAuth 2.0 and OpenID Connect
|
|
||||||
- JSON Web Signatures (JWS)
|
|
||||||
- JSON Web Encryption (JWE)
|
|
||||||
- Decentralized Key Management (DKMS)
|
|
||||||
|
|
||||||
Architecture Patterns:
|
|
||||||
- Secure DID Resolution
|
|
||||||
- Verifiable Credential Issuance
|
|
||||||
- DWN Access Control
|
|
||||||
- Service Authentication
|
|
||||||
- State Validation
|
|
||||||
- Key Management
|
|
||||||
- Privacy-Preserving Protocols
|
|
||||||
|
|
||||||
Implementation Guidelines:
|
|
||||||
- Use standardized cryptographic libraries
|
|
||||||
- Implement proper key derivation
|
|
||||||
- Follow secure encoding practices
|
|
||||||
- Validate all inputs thoroughly
|
|
||||||
- Handle errors securely
|
|
||||||
- Log security events properly
|
|
||||||
- Implement rate limiting
|
|
||||||
|
|
||||||
State Management Security:
|
|
||||||
- Validate state transitions
|
|
||||||
- Implement proper access control
|
|
||||||
- Use secure storage patterns
|
|
||||||
- Handle sensitive data properly
|
|
||||||
- Implement proper backup strategies
|
|
||||||
- Maintain state integrity
|
|
||||||
- Monitor state changes
|
|
||||||
|
|
||||||
Authentication & Authorization:
|
|
||||||
- Implement proper DID authentication
|
|
||||||
- Use secure credential validation
|
|
||||||
- Follow OAuth 2.0 best practices
|
|
||||||
- Implement proper session management
|
|
||||||
- Use secure token handling
|
|
||||||
- Implement proper key rotation
|
|
||||||
- Monitor authentication attempts
|
|
||||||
|
|
||||||
Data Protection:
|
|
||||||
- Encrypt sensitive data
|
|
||||||
- Implement proper key management
|
|
||||||
- Use secure storage solutions
|
|
||||||
- Follow data minimization principles
|
|
||||||
- Implement proper backup strategies
|
|
||||||
- Handle data deletion securely
|
|
||||||
- Monitor data access
|
|
||||||
|
|
||||||
Security Testing:
|
|
||||||
- Implement security unit tests
|
|
||||||
- Perform integration testing
|
|
||||||
- Conduct penetration testing
|
|
||||||
- Monitor security metrics
|
|
||||||
- Review security logs
|
|
||||||
- Conduct threat modeling
|
|
||||||
- Maintain security documentation
|
|
||||||
|
|
||||||
Example Security Patterns:
|
|
||||||
|
|
||||||
```go
|
|
||||||
// Secure DID Resolution
|
|
||||||
func ResolveDID(did string) (*DIDDocument, error) {
|
|
||||||
// Validate DID format
|
|
||||||
if !ValidateDIDFormat(did) {
|
|
||||||
return nil, ErrInvalidDID
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve with retry and timeout
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), resolveTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
doc, err := resolver.ResolveWithContext(ctx, did)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("resolution failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate document structure
|
|
||||||
if err := ValidateDIDDocument(doc); err != nil {
|
|
||||||
return nil, fmt.Errorf("invalid document: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return doc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Secure Credential Verification
|
|
||||||
func VerifyCredential(vc *VerifiableCredential) error {
|
|
||||||
// Check expiration
|
|
||||||
if vc.IsExpired() {
|
|
||||||
return ErrCredentialExpired
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify proof
|
|
||||||
if err := vc.VerifyProof(trustRegistry); err != nil {
|
|
||||||
return fmt.Errorf("invalid proof: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify status
|
|
||||||
if err := vc.CheckRevocationStatus(); err != nil {
|
|
||||||
return fmt.Errorf("revocation check failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Security Checklist:
|
|
||||||
1. All DIDs follow W3C specification
|
|
||||||
2. Credentials implement proper proofs
|
|
||||||
3. Keys use proper derivation/rotation
|
|
||||||
4. State changes are validated
|
|
||||||
5. Access control is enforced
|
|
||||||
6. Data is properly encrypted
|
|
||||||
7. Logging captures security events
|
|
||||||
|
|
||||||
Refer to W3C specifications, Cosmos SDK security documentation, and blockchain security best practices for detailed implementation guidance.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# To get started with Dependabot version updates, you'll need to specify which
|
|
||||||
# package ecosystems to update and where the package manifests are located.
|
|
||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "gomod" # See documentation for possible values
|
|
||||||
directory: "/" # Location of package manifests
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
"@pr/feature": ["feature/*", "feat/*"]
|
"feature": ["feature/*", "feat/*"]
|
||||||
"@pr/fix": fix/*
|
"bugfix": fix/*
|
||||||
"@pr/chore": chore/*
|
"enhancement": enhancement/*
|
||||||
"@pr/docs": docs/*
|
|
||||||
"@pr/refactor": refactor/*
|
|
||||||
|
|||||||
+249
-427
@@ -1,427 +1,249 @@
|
|||||||
[
|
{
|
||||||
{
|
"scopes": [
|
||||||
"name": "app/cosmos-sdk",
|
"core-chain",
|
||||||
"path": "app",
|
"core-ibc",
|
||||||
"docs": [
|
"x-did",
|
||||||
{
|
"x-dwn",
|
||||||
"keywords": [
|
"x-svc",
|
||||||
"module",
|
"security-mpc",
|
||||||
"cosmos"
|
"security-ucan",
|
||||||
],
|
"security-zkp",
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
|
"ci-cd",
|
||||||
},
|
"dev-ops"
|
||||||
{
|
],
|
||||||
"keywords": [
|
"docs": [
|
||||||
"protobuf",
|
{
|
||||||
"cosmos"
|
"keywords": ["github", "actions", "workflows", "syntax"],
|
||||||
],
|
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["cosmos", "tooling", "cosmovisor"],
|
||||||
"keywords": [
|
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
|
||||||
"rpc",
|
},
|
||||||
"protobuf",
|
{
|
||||||
"service",
|
"keywords": ["process-compose", "configuration"],
|
||||||
"cosmos"
|
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
|
||||||
],
|
},
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
|
{
|
||||||
},
|
"keywords": ["taskfile", "cli", "reference"],
|
||||||
{
|
"url": "https://taskfile.dev/reference/cli"
|
||||||
"keywords": [
|
},
|
||||||
"protobuf",
|
{
|
||||||
"rpc",
|
"keywords": [],
|
||||||
"cosmos",
|
"url": "https://taskfile.dev/reference/schema"
|
||||||
"query"
|
},
|
||||||
],
|
{
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
|
"keywords": ["taskfile", "templating", "reference"],
|
||||||
},
|
"url": "https://taskfile.dev/reference/templating/"
|
||||||
{
|
},
|
||||||
"keywords": [
|
{
|
||||||
"cosmos",
|
"keywords": ["mkdocs", "material", "reference"],
|
||||||
"depinject",
|
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
|
||||||
"sdk"
|
},
|
||||||
],
|
{
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
|
"keywords": ["pkl", "language", "reference"],
|
||||||
}
|
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||||
]
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["pwa", "service-workers", "web"],
|
||||||
"name": "app/ibc",
|
"url": "https://web.dev/learn/pwa/service-workers/"
|
||||||
"path": "app",
|
},
|
||||||
"docs": [
|
{
|
||||||
{
|
"keywords": ["service-workers", "web", "api"],
|
||||||
"keywords": [
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||||
"cosmos",
|
},
|
||||||
"interchain",
|
{
|
||||||
"accounts"
|
"keywords": ["web-authentication", "web", "api"],
|
||||||
],
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API"
|
||||||
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["sdk", "modules", "cosmos", "manager"],
|
||||||
"keywords": [],
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
|
||||||
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["sdk", "modules", "cosmos", "messages", "queries"],
|
||||||
"keywords": [],
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
|
||||||
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["sdk", "modules", "messages", "service", "cosmos"],
|
||||||
"keywords": [],
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
|
||||||
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["sdk", "modules", "services", "cosmos", "query"],
|
||||||
"keywords": [
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
|
||||||
"usdc",
|
},
|
||||||
"mint",
|
{
|
||||||
"cosmos",
|
"keywords": ["cosmos", "depinject", "modules", "sdk"],
|
||||||
"noble"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
|
||||||
],
|
},
|
||||||
"url": "https://docs.noble.xyz/cctp/mint"
|
{
|
||||||
},
|
"keywords": ["ibc", "apps", "sdk", "interchain-accounts"],
|
||||||
{
|
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
|
||||||
"keywords": [
|
},
|
||||||
"usdc"
|
{
|
||||||
],
|
"keywords": ["ibc", "apps", "sdk", "transfer"],
|
||||||
"url": "https://docs.noble.xyz/cctp/mint_forward"
|
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [],
|
"keywords": ["osmosis", "modules", "ibc", "assets"],
|
||||||
"url": "https://docs.evmos.org/protocol/modules/erc20"
|
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [],
|
"keywords": ["ibc", "osmosis", "tokenfactory", "modules", "assets"],
|
||||||
"url": "https://docs.nomic.io/nbtc"
|
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
},
|
"keywords": ["ibc", "mint", "cctp", "noble", "assets"],
|
||||||
{
|
"url": "https://docs.noble.xyz/cctp/mint"
|
||||||
"name": "crypto/mpc",
|
},
|
||||||
"path": "crypto/mpc",
|
{
|
||||||
"docs": [
|
"keywords": ["ibc", "relayer", "nomic", "assets"],
|
||||||
{
|
"url": "https://docs.nomic.io/network/ibc-relayer"
|
||||||
"keywords": [
|
},
|
||||||
"mpc",
|
{
|
||||||
"wallet",
|
"keywords": ["ibc", "cctp", "noble", "mint_forward", "assets"],
|
||||||
"security",
|
"url": "https://docs.noble.xyz/cctp/mint_forward"
|
||||||
"advanced cryptography"
|
},
|
||||||
],
|
{
|
||||||
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
|
"keywords": ["evmos", "erc20", "assets"],
|
||||||
}
|
"url": "https://docs.evmos.org/protocol/modules/erc20"
|
||||||
]
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["nomic", "nbtc", "assets"],
|
||||||
"name": "crypto/ucan",
|
"url": "https://docs.nomic.io/nbtc"
|
||||||
"path": "crypto/ucan",
|
},
|
||||||
"docs": [
|
{
|
||||||
{
|
"keywords": ["mpc", "wallet", "cryptography", "capability", "invokation"],
|
||||||
"keywords": [],
|
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
|
||||||
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
|
},
|
||||||
}
|
{
|
||||||
]
|
"keywords": ["ucan", "spec", "cryptography", "authorization"],
|
||||||
},
|
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
|
||||||
{
|
},
|
||||||
"name": "crypto/zkp",
|
{
|
||||||
"path": "crypto/accumulator",
|
"keywords": ["zero-knowledge", "proofs", "cryptography", "privacy"],
|
||||||
"docs": [
|
"url": "https://eprint.iacr.org/2021/1672.pdf"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://eprint.iacr.org/2021/1672.pdf"
|
"keywords": ["gateway", "http", "sse"],
|
||||||
}
|
"url": "https://echo.labstack.com/docs/cookbook/sse"
|
||||||
]
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["gateway", "http", "websocket"],
|
||||||
"name": "gateway/handlers",
|
"url": "https://echo.labstack.com/docs/cookbook/websocket"
|
||||||
"path": "pkg/gateway/handlers",
|
},
|
||||||
"docs": [
|
{
|
||||||
{
|
"keywords": ["gateway", "http", "subdomain"],
|
||||||
"keywords": [],
|
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/sse"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["tigerbeetle", "models", "oracle"],
|
||||||
"keywords": [],
|
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/websocket"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["tigerbeetle", "two=phase", "transfers", "oracle"],
|
||||||
"keywords": [],
|
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
|
},
|
||||||
}
|
{
|
||||||
]
|
"keywords": [
|
||||||
},
|
"tigerbeetle",
|
||||||
{
|
"oracle",
|
||||||
"name": "gateway/database",
|
"reliable",
|
||||||
"path": "pkg/gateway/internal/database",
|
"transaction",
|
||||||
"docs": [
|
"submission"
|
||||||
{
|
],
|
||||||
"keywords": [],
|
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
|
||||||
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["currency", "exchange", "tigerbeetle", "oracle"],
|
||||||
"keywords": [],
|
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
|
||||||
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": [
|
||||||
"keywords": [],
|
"balance",
|
||||||
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
|
"tigerbeetle",
|
||||||
},
|
"oracle",
|
||||||
{
|
"conditional",
|
||||||
"keywords": [
|
"transfers"
|
||||||
"currency"
|
],
|
||||||
],
|
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
|
||||||
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["tigerbeetle", "account", "oracle"],
|
||||||
"keywords": [
|
"url": "https://docs.tigerbeetle.com/reference/account"
|
||||||
"balance"
|
},
|
||||||
],
|
{
|
||||||
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
|
"keywords": ["tigerbeetle", "transfer", "oracle"],
|
||||||
},
|
"url": "https://docs.tigerbeetle.com/reference/transfer"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://docs.tigerbeetle.com/reference/account"
|
"keywords": ["substreams", "packages", "consumer", "oracle"],
|
||||||
},
|
"url": "https://docs.substreams.dev/documentation/consume/packages"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://docs.tigerbeetle.com/reference/transfer"
|
"keywords": ["substreams", "deploy", "service", "oracle"],
|
||||||
},
|
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://docs.substreams.dev/documentation/consume/packages"
|
"keywords": ["substreams", "tutorial", "cosmos", "injective"],
|
||||||
},
|
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
|
"keywords": ["worker", "http", "jwt"],
|
||||||
},
|
"url": "https://echo.labstack.com/docs/cookbook/jwt"
|
||||||
{
|
},
|
||||||
"keywords": [],
|
{
|
||||||
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
|
"keywords": ["worker", "http", "secure"],
|
||||||
}
|
"url": "https://echo.labstack.com/docs/middleware/secure"
|
||||||
]
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["worker", "http", "service-workers", "web", "api"],
|
||||||
"name": "vault/handlers",
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||||
"path": "pkg/vault/handlers",
|
},
|
||||||
"docs": [
|
{
|
||||||
{
|
"keywords": ["synapse", "matrix", "configuration", "usage"],
|
||||||
"keywords": [],
|
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/jwt"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["cosmos", "protobuf", "orm", "sdk"],
|
||||||
"keywords": [],
|
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
||||||
"url": "https://echo.labstack.com/docs/middleware/secure"
|
},
|
||||||
},
|
{
|
||||||
{
|
"keywords": ["cosmos", "sdk", "modules", "auth"],
|
||||||
"keywords": [],
|
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
|
||||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
},
|
||||||
}
|
{
|
||||||
]
|
"keywords": ["cosmos", "sdk", "modules", "bank"],
|
||||||
},
|
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
|
||||||
{
|
},
|
||||||
"name": "vault/database",
|
{
|
||||||
"path": "pkg/vault/internal/database",
|
"keywords": ["cosmos", "modules", "authz", "sdk"],
|
||||||
"docs": [
|
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
|
||||||
"https://dexie.org/docs/ExportImport/dexie-export-import",
|
},
|
||||||
"https://dexie.org/docs/API-Reference#quick-reference",
|
{
|
||||||
"https://templ.guide/syntax-and-usage/script-templates"
|
"keywords": ["cosmos", "protobuf", "collections", "sdk"],
|
||||||
]
|
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pkl/ipfs",
|
"keywords": ["cosmos", "modules", "gov", "sdk"],
|
||||||
"path": "pkl/ipfs.net",
|
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
|
||||||
"docs": [
|
},
|
||||||
{
|
{
|
||||||
"keywords": [],
|
"keywords": ["cosmos", "modules", "staking", "sdk"],
|
||||||
"url": "https://github.com/ipfs/kubo/blob/master/docs/config.md"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [],
|
"keywords": ["cosmos", "protobuf", "annotations", "sdk"],
|
||||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
},
|
"keywords": ["cosmos", "sdk", "modules", "group"],
|
||||||
{
|
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
|
||||||
"name": "pkl/matrix",
|
},
|
||||||
"path": "pkl/matrix.net",
|
{
|
||||||
"docs": [
|
"keywords": ["cosmos", "sdk", "modules", "nft"],
|
||||||
{
|
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
|
||||||
"keywords": [],
|
}
|
||||||
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
|
],
|
||||||
},
|
"next-milestone": "34"
|
||||||
{
|
}
|
||||||
"keywords": [],
|
|
||||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pkl/chain",
|
|
||||||
"path": "pkl/sonr.chain",
|
|
||||||
"docs": [
|
|
||||||
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/5-network.html",
|
|
||||||
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/4-genesis.html",
|
|
||||||
"https://pkl-lang.org/main/current/language-reference/index.html",
|
|
||||||
"https://docs.cosmos.network/v0.50/user/run-node/run-testnet"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pkl/hway",
|
|
||||||
"path": "pkl/sonr.hway",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pkl/motr",
|
|
||||||
"path": "pkl/sonr.motr",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://web.dev/learn/pwa/service-workers/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "x/did",
|
|
||||||
"path": "proto/did",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "x/dwn",
|
|
||||||
"path": "proto/dwn",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "x/svc",
|
|
||||||
"path": "proto/svc",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "repo/ci-cd",
|
|
||||||
"path": "deploy",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://docs.nomic.io/network/ibc-relayer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://www.jetify.com/docs/devbox"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://taskfile.dev/reference/cli"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://taskfile.dev/reference/schema"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://taskfile.dev/reference/templating/"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "repo/docs",
|
|
||||||
"path": "docs",
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keywords": [],
|
|
||||||
"url": "https://github.com/mkdocs/catalog/blob/main/README.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
ROOT_DIR=$(git rev-parse --show-toplevel)
|
|
||||||
|
|
||||||
# Extract scope name and path using jq, and pass it to fzf for selection
|
|
||||||
SCOPE=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r '.[] | "\(.name)"' | fzf --prompt "Select scope:")
|
|
||||||
DOCS=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r ".[] | select(.name == \"$SCOPE\") | .docs[].url")
|
|
||||||
|
|
||||||
# Write Title
|
|
||||||
TITLE=$(gum input --placeholder "Issue Title...")
|
|
||||||
|
|
||||||
# Write Goal
|
|
||||||
GOAL=$(mods --role "determine-issue-goal" "$SCOPE $TITLE")
|
|
||||||
|
|
||||||
# Input Requirements
|
|
||||||
REQUIREMENTS=()
|
|
||||||
while true; do
|
|
||||||
if [ ${#REQUIREMENTS[@]} -ge 2 ]; then
|
|
||||||
if ! gum confirm "Do you want to add another requirement?"; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
REQUIREMENT=$(gum input --placeholder "Add a requirement...")
|
|
||||||
if [ -n "$REQUIREMENT" ]; then
|
|
||||||
REQUIREMENTS+=("$REQUIREMENT")
|
|
||||||
else
|
|
||||||
echo "Requirement cannot be empty. Please enter a valid requirement."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
create_body() {
|
|
||||||
echo "### Goal(s):"
|
|
||||||
echo "$GOAL"
|
|
||||||
echo "### Requirements:"
|
|
||||||
for i in "${!REQUIREMENTS[@]}"; do
|
|
||||||
echo "$(($i + 1)). ${REQUIREMENTS[$i]}"
|
|
||||||
done
|
|
||||||
echo "### Resources:"
|
|
||||||
while IFS= read -r doc; do
|
|
||||||
echo "- $doc"
|
|
||||||
done <<< "$DOCS"
|
|
||||||
}
|
|
||||||
|
|
||||||
ISSUE_BODY=$(create_body)
|
|
||||||
|
|
||||||
# Function to collect output
|
|
||||||
preview_output() {
|
|
||||||
echo "# ($SCOPE) $TITLE"
|
|
||||||
echo "$ISSUE_BODY"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Display the formatted output
|
|
||||||
preview_output | gum format
|
|
||||||
|
|
||||||
# Confirm to create a GitHub issue
|
|
||||||
if gum confirm "Do you want to create a new GitHub issue with this information?"; then
|
|
||||||
# Create a new GitHub issue using the gh CLI
|
|
||||||
gh issue create --repo onsonr/sonr --title "($SCOPE) $TITLE" --body "$ISSUE_BODY"
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
ROOT_DIR=$(git rev-parse --show-toplevel)
|
|
||||||
|
|
||||||
# Package the PKL projects
|
|
||||||
bunx pkl project package $ROOT_DIR/pkl/*/
|
|
||||||
|
|
||||||
# Process each directory in .out
|
|
||||||
for dir in .out/*/; do
|
|
||||||
# Get the folder name and version
|
|
||||||
folder=$(basename "$dir")
|
|
||||||
version=$(echo "$folder" | grep -o '@.*' | sed 's/@//')
|
|
||||||
new_folder=$(echo "$folder" | sed 's/@[0-9.]*$//')
|
|
||||||
|
|
||||||
# Create new directory without version
|
|
||||||
mkdir -p ".out/$new_folder/$version"
|
|
||||||
|
|
||||||
# Copy contents to versioned subdirectory
|
|
||||||
cp -r "$dir"* ".out/$new_folder/$version/"
|
|
||||||
|
|
||||||
# Find and copy only .pkl files from the original package
|
|
||||||
pkg_dir="$ROOT_DIR/pkl/$new_folder"
|
|
||||||
if [ -d "$pkg_dir" ]; then
|
|
||||||
# Copy only .pkl files to version directory
|
|
||||||
find "$pkg_dir" -name "*.pkl" -exec cp {} ".out/$new_folder/$version/" \;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove old versioned directory
|
|
||||||
rm -rf "$dir"
|
|
||||||
|
|
||||||
# Upload to R2 with new structure
|
|
||||||
rclone copy ".out/$new_folder" "r2:pkljar/$new_folder"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Cleanup .out directory
|
|
||||||
rm -rf .out
|
|
||||||
|
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
name: Check PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
merge_group:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||||
|
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
verify-pr:
|
||||||
|
name: Test Lints
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
permissions:
|
||||||
|
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||||
|
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Required to fetch all history for merging
|
||||||
|
|
||||||
|
- uses: TimonVS/pr-labeler-action@v5
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
|
||||||
|
- name: Trunk Check
|
||||||
|
uses: trunk-io/trunk-action@v1
|
||||||
|
|
||||||
|
test-builds:
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Builds
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
- name: Run Sonrd Build
|
||||||
|
run: make build
|
||||||
|
|
||||||
|
test-unit:
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Unit
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
- run: make test-unit
|
||||||
|
|
||||||
|
validate-release:
|
||||||
|
if: github.event_name == 'merge_group' || github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Version
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Install Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Version Check
|
||||||
|
run: make validate-tag
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Check GoReleaser Config
|
||||||
|
run: make release-check
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
name: Run All Checks
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
merge_group:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-builds:
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Run Build Tests
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
- name: Run Sonrd Build
|
|
||||||
run: make build
|
|
||||||
- name: Run Hway Build
|
|
||||||
run: make build-hway
|
|
||||||
- name: Run Motr Build
|
|
||||||
run: make build-motr
|
|
||||||
|
|
||||||
test-unit:
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Run Unit Tests
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
- run: make test-unit
|
|
||||||
|
|
||||||
test-race:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'merge_group'
|
|
||||||
name: Run Race Tests
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
- run: make test-race
|
|
||||||
|
|
||||||
test-cover:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'merge_group'
|
|
||||||
name: Run Coverage Tests
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
- run: make test-cover
|
|
||||||
|
|
||||||
goreleaser-check:
|
|
||||||
if: github.event_name == 'merge_group'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Check GoReleaser Config
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Check GoReleaser Config
|
|
||||||
uses: goreleaser/goreleaser-action@v6
|
|
||||||
with:
|
|
||||||
distribution: goreleaser-pro
|
|
||||||
version: latest
|
|
||||||
args: check
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
||||||
|
|
||||||
- name: GoReleaser Dry Run
|
|
||||||
uses: goreleaser/goreleaser-action@v6
|
|
||||||
with:
|
|
||||||
distribution: goreleaser-pro
|
|
||||||
version: latest
|
|
||||||
args: release --snapshot --clean --skip=publish
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
name: Deploy Networks
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
reboot-devnet:
|
|
||||||
name: Devnet Deploy
|
|
||||||
runs-on: goliath
|
|
||||||
environment: "Devnet"
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
branch: develop
|
|
||||||
|
|
||||||
- name: Stop Existing Network
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
make stop-uds
|
|
||||||
make clean
|
|
||||||
|
|
||||||
- name: Start Updated Network
|
|
||||||
run: |
|
|
||||||
make start-uds
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
name: PR Labeler
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, edited]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pr-labeler:
|
|
||||||
permissions:
|
|
||||||
contents: read # for TimonVS/pr-labeler-action to read config file
|
|
||||||
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: TimonVS/pr-labeler-action@v5
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
name: Publish Docs via GitHub Pages
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
paths:
|
|
||||||
- "docs/**"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Configure Git Credentials
|
|
||||||
run: |
|
|
||||||
git config user.name github-actions[bot]
|
|
||||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: 3.x
|
|
||||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
key: mkdocs-material-${{ env.cache_id }}
|
|
||||||
path: .cache
|
|
||||||
restore-keys: |
|
|
||||||
mkdocs-material-
|
|
||||||
- run: pip install mkdocs-material
|
|
||||||
- run: cd docs && mkdocs gh-deploy --force
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
name: Merge Group
|
||||||
|
|
||||||
|
on:
|
||||||
|
merge_group:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||||
|
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-race:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'merge_group'
|
||||||
|
name: Test Race
|
||||||
|
continue-on-error: true
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
- run: make test-race
|
||||||
|
|
||||||
|
test-cover:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'merge_group'
|
||||||
|
name: Test Coverage
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
- run: make test-cover
|
||||||
|
|
||||||
|
test-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Release
|
||||||
|
if: github.event_name == 'merge_group'
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Release Dry Run
|
||||||
|
run: make release-dry
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
name: Post Merge
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-version:
|
||||||
|
name: Sync Version
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
branch: main
|
||||||
|
fetch-depth: 0
|
||||||
|
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Update Version
|
||||||
|
run: |
|
||||||
|
# Get tag without 'v' prefix
|
||||||
|
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
|
||||||
|
# Checkout main branch
|
||||||
|
git fetch origin main
|
||||||
|
git checkout main
|
||||||
|
|
||||||
|
# Update version in .cz.toml
|
||||||
|
sed -i "s/^version = \".*\"/version = \"$TAG_VERSION\"/" .cz.toml
|
||||||
|
|
||||||
|
# Configure git
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
# Commit and push if there are changes
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "Version already synchronized"
|
||||||
|
else
|
||||||
|
git add .cz.toml
|
||||||
|
git commit -m "chore: sync version to ${TAG_VERSION} [skip ci]"
|
||||||
|
git push origin main
|
||||||
|
fi
|
||||||
|
|
||||||
|
bump-version:
|
||||||
|
name: Cz Bump
|
||||||
|
if: |
|
||||||
|
github.event.pull_request.merged == true &&
|
||||||
|
github.event.pull_request.user.login != 'dependabot[bot]' &&
|
||||||
|
github.event.pull_request.user.login != 'dependabot-preview[bot]'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||||
|
|
||||||
|
- name: Create bump and changelog
|
||||||
|
uses: commitizen-tools/commitizen-action@master
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
increment: patch
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
- name: Push using ssh
|
||||||
|
run: |
|
||||||
|
git push origin main --tags
|
||||||
|
|
||||||
|
new-release:
|
||||||
|
name: Create Release
|
||||||
|
needs: [sync-version]
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
permissions: write-all
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: onsonr/sonr
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Fetch Release Date
|
||||||
|
run: |
|
||||||
|
echo "RELEASE_DATE=$(date +%Y).$(date +%V).$(date +%u)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
version: "~> v2"
|
||||||
|
args: release --clean
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
|
||||||
|
GITHUB_PERSONAL_AUTH_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
REDDIT_APP_ID: ${{ secrets.REDDIT_APP_ID }}
|
||||||
|
REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }}
|
||||||
|
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
|
||||||
|
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
|
||||||
|
RELEASE_DATE: ${{ env.RELEASE_DATE }}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
name: Publish Versioned Assets
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buf_push_core:
|
|
||||||
name: Publish to buf.build/onsonr/sonr
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Run `git checkout`
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
# Install the `buf` CLI
|
|
||||||
- uses: bufbuild/buf-setup-action@v1
|
|
||||||
# Push only the Input in `proto` to the BSR
|
|
||||||
- uses: bufbuild/buf-push-action@v1
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
input: proto
|
|
||||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
name: Post Release
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buf_push:
|
||||||
|
name: Publish Protobufs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Run `git checkout`
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# Install the `buf` CLI
|
||||||
|
- uses: bufbuild/buf-setup-action@v1
|
||||||
|
# Push only the Input in `proto` to the BSR
|
||||||
|
- uses: bufbuild/buf-push-action@v1
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
input: proto
|
||||||
|
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||||
|
|
||||||
|
container-push:
|
||||||
|
name: Publish Docker Images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/onsonr/sonr:latest
|
||||||
|
|
||||||
|
docs-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish Tech Docs
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Configure Git Credentials
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions[bot]
|
||||||
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
|
path: .cache
|
||||||
|
restore-keys: |
|
||||||
|
mkdocs-material-
|
||||||
|
- run: pip install mkdocs-material
|
||||||
|
- run: mkdocs gh-deploy --force
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
name: Versioned Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
||||||
workflow_dispatch:
|
|
||||||
repository_dispatch:
|
|
||||||
types: [trigger-release]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-release:
|
|
||||||
name: Check Existing Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
release_exists: ${{ steps.check.outputs.release_exists }}
|
|
||||||
is_tag: ${{ steps.check-ref.outputs.is_tag }}
|
|
||||||
ref_name: ${{ steps.check-ref.outputs.ref_name }}
|
|
||||||
steps:
|
|
||||||
- name: Determine ref type and name
|
|
||||||
id: check-ref
|
|
||||||
run: |
|
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
echo "is_tag=true" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "ref_name=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "is_tag=false" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "ref_name=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check if release exists
|
|
||||||
id: check
|
|
||||||
if: steps.check-ref.outputs.is_tag == 'true'
|
|
||||||
run: |
|
|
||||||
RELEASE_EXISTS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
"https://api.github.com/repos/onsonr/sonr/releases/tags/${GITHUB_REF#refs/tags/}" \
|
|
||||||
| jq -r 'if .message == "Not Found" then "false" else "true" end')
|
|
||||||
echo "release_exists=$RELEASE_EXISTS" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
goreleaser:
|
|
||||||
name: Run GoReleaser
|
|
||||||
needs: check-release
|
|
||||||
if: |
|
|
||||||
(needs.check-release.outputs.is_tag == 'true' && needs.check-release.outputs.release_exists == 'false') ||
|
|
||||||
(needs.check-release.outputs.is_tag == 'false')
|
|
||||||
permissions: write-all
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: onsonr/sonr
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- name: Set up release configuration
|
|
||||||
id: setup
|
|
||||||
run: |
|
|
||||||
if [[ "${{ needs.check-release.outputs.is_tag }}" == "true" ]]; then
|
|
||||||
echo "Using tag configuration"
|
|
||||||
git checkout ${{ needs.check-release.outputs.ref_name }}
|
|
||||||
echo "args=release --clean" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "Using snapshot configuration"
|
|
||||||
echo "args=release --snapshot --clean" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.23"
|
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Release
|
|
||||||
uses: goreleaser/goreleaser-action@v6
|
|
||||||
with:
|
|
||||||
distribution: goreleaser-pro
|
|
||||||
version: latest
|
|
||||||
args: ${{ steps.setup.outputs.args }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
|
|
||||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
||||||
GITHUB_PERSONAL_AUTH_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
name: Update Version and Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bump-version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: "Bump Version"
|
|
||||||
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
|
|
||||||
outputs:
|
|
||||||
new_tag: ${{ steps.bump.outputs.new_tag }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Create bump and changelog
|
|
||||||
id: bump
|
|
||||||
uses: commitizen-tools/commitizen-action@master
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
increment: "PATCH"
|
|
||||||
|
|
||||||
trigger-release:
|
|
||||||
needs: [bump-version]
|
|
||||||
if: needs.bump-version.outputs.new_tag != ''
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Trigger release workflow
|
|
||||||
uses: peter-evans/repository-dispatch@v2
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
event-type: trigger-release
|
|
||||||
client-payload: '{"tag": "${{ needs.bump-version.outputs.new_tag }}"}'
|
|
||||||
+9
-1
@@ -1,4 +1,8 @@
|
|||||||
|
# Aider related generated files
|
||||||
|
.aider-context
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
|
.task
|
||||||
no
|
no
|
||||||
.data
|
.data
|
||||||
schemas
|
schemas
|
||||||
@@ -61,7 +65,7 @@ override.tf.json
|
|||||||
|
|
||||||
.terraformrc
|
.terraformrc
|
||||||
terraform.rc
|
terraform.rc
|
||||||
|
flake.lock
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -87,6 +91,7 @@ buildenv*
|
|||||||
node_modules
|
node_modules
|
||||||
cmd/gateway/node_modules
|
cmd/gateway/node_modules
|
||||||
pkg/nebula/node_modules
|
pkg/nebula/node_modules
|
||||||
|
configs/logs.json
|
||||||
|
|
||||||
mprocs.yaml
|
mprocs.yaml
|
||||||
build
|
build
|
||||||
@@ -100,4 +105,7 @@ mprocs.yaml
|
|||||||
mprocs.log
|
mprocs.log
|
||||||
tools-stamp
|
tools-stamp
|
||||||
sonr.log
|
sonr.log
|
||||||
|
deploy/conf
|
||||||
|
|
||||||
|
interchaintest-downloader
|
||||||
|
.haptic
|
||||||
|
|||||||
+11
-82
@@ -2,12 +2,14 @@
|
|||||||
version: 2
|
version: 2
|
||||||
project_name: sonr
|
project_name: sonr
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- echo "Release date is {{ .Env.RELEASE_DATE }}"
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- id: sonr
|
- id: sonr
|
||||||
main: ./cmd/sonrd
|
main: ./cmd/sonrd
|
||||||
binary: sonrd
|
binary: sonrd
|
||||||
builder: go
|
|
||||||
gobinary: go
|
|
||||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
@@ -30,47 +32,11 @@ builds:
|
|||||||
- netgo
|
- netgo
|
||||||
- ledger
|
- ledger
|
||||||
|
|
||||||
- id: hway
|
|
||||||
main: ./cmd/hway
|
|
||||||
binary: hway
|
|
||||||
builder: go
|
|
||||||
gobinary: go
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
- darwin
|
|
||||||
goarch:
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
|
||||||
flags:
|
|
||||||
- -mod=readonly
|
|
||||||
- -trimpath
|
|
||||||
goamd64:
|
|
||||||
- v1
|
|
||||||
tags:
|
|
||||||
- netgo
|
|
||||||
ldflags:
|
|
||||||
- -X main.version={{.Version}}
|
|
||||||
- -X main.commit={{.Commit}}
|
|
||||||
- -X main.date={{.Date}}
|
|
||||||
archives:
|
archives:
|
||||||
- id: sonr
|
- id: sonr
|
||||||
builds: [sonr]
|
builds: [sonr]
|
||||||
name_template: >-
|
name_template: >-
|
||||||
sonr_{{ .Version }}_
|
sonr_{{ .Os }}_{{- if eq .Arch "amd64" }}x86_64
|
||||||
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
|
|
||||||
{{- else if eq .Arch "386" }}i386
|
|
||||||
{{- else }}{{ .Arch }}{{ end }}
|
|
||||||
format: tar.gz
|
|
||||||
files:
|
|
||||||
- src: README*
|
|
||||||
wrap_in_directory: true
|
|
||||||
|
|
||||||
- id: hway
|
|
||||||
builds: [hway]
|
|
||||||
name_template: >-
|
|
||||||
hway_{{ .Version }}_
|
|
||||||
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
|
|
||||||
{{- else if eq .Arch "386" }}i386
|
{{- else if eq .Arch "386" }}i386
|
||||||
{{- else }}{{ .Arch }}{{ end }}
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
format: tar.gz
|
format: tar.gz
|
||||||
@@ -79,32 +45,9 @@ archives:
|
|||||||
wrap_in_directory: true
|
wrap_in_directory: true
|
||||||
|
|
||||||
nfpms:
|
nfpms:
|
||||||
- id: hway
|
|
||||||
package_name: hway
|
|
||||||
file_name_template: "{{ .ConventionalFileName }}"
|
|
||||||
builds: [hway]
|
|
||||||
vendor: Sonr
|
|
||||||
homepage: "https://onsonr.dev"
|
|
||||||
maintainer: "Sonr <support@onsonr.dev>"
|
|
||||||
description: "Sonr Highway is a decentralized, permissionless, and censorship-resistant identity network proxy."
|
|
||||||
license: "Apache 2.0"
|
|
||||||
formats:
|
|
||||||
- rpm
|
|
||||||
- deb
|
|
||||||
- apk
|
|
||||||
dependencies:
|
|
||||||
- ipfs
|
|
||||||
contents:
|
|
||||||
- src: README*
|
|
||||||
dst: /usr/share/doc/hway
|
|
||||||
bindir: /usr/bin
|
|
||||||
section: net
|
|
||||||
priority: optional
|
|
||||||
# Add these lines to match build config
|
|
||||||
|
|
||||||
- id: sonr
|
- id: sonr
|
||||||
package_name: sonrd
|
package_name: sonrd
|
||||||
file_name_template: "{{ .ConventionalFileName }}"
|
file_name_template: "sonrd_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
|
||||||
builds: [sonr]
|
builds: [sonr]
|
||||||
vendor: Sonr
|
vendor: Sonr
|
||||||
homepage: "https://onsonr.dev"
|
homepage: "https://onsonr.dev"
|
||||||
@@ -126,23 +69,6 @@ nfpms:
|
|||||||
# Add these lines to match build config
|
# Add these lines to match build config
|
||||||
|
|
||||||
brews:
|
brews:
|
||||||
- name: hway
|
|
||||||
ids: [hway]
|
|
||||||
commit_author:
|
|
||||||
name: goreleaserbot
|
|
||||||
email: bot@goreleaser.com
|
|
||||||
directory: Formula
|
|
||||||
caveats: "Run a local hway node and access it with the hway proxy"
|
|
||||||
homepage: "https://onsonr.dev"
|
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
|
||||||
dependencies:
|
|
||||||
- name: ipfs
|
|
||||||
repository:
|
|
||||||
owner: onsonr
|
|
||||||
name: homebrew-tap
|
|
||||||
branch: master
|
|
||||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
|
||||||
|
|
||||||
- name: sonr
|
- name: sonr
|
||||||
ids: [sonr]
|
ids: [sonr]
|
||||||
commit_author:
|
commit_author:
|
||||||
@@ -150,7 +76,7 @@ brews:
|
|||||||
email: bot@goreleaser.com
|
email: bot@goreleaser.com
|
||||||
directory: Formula
|
directory: Formula
|
||||||
caveats: "Run a local sonr node and access it with the hway proxy"
|
caveats: "Run a local sonr node and access it with the hway proxy"
|
||||||
homepage: "https://onsonr.dev"
|
homepage: "https://onson.dev"
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: ipfs
|
- name: ipfs
|
||||||
@@ -164,12 +90,15 @@ release:
|
|||||||
github:
|
github:
|
||||||
owner: onsonr
|
owner: onsonr
|
||||||
name: sonr
|
name: sonr
|
||||||
name_template: "Release {{.Version}}"
|
name_template: "{{ .Tag }} | {{ .Env.RELEASE_DATE }}"
|
||||||
draft: false
|
draft: false
|
||||||
replace_existing_draft: true
|
replace_existing_draft: true
|
||||||
replace_existing_artifacts: true
|
replace_existing_artifacts: true
|
||||||
extra_files:
|
extra_files:
|
||||||
- glob: ./README*
|
- glob: ./README*
|
||||||
|
- glob: ./scripts/install.sh
|
||||||
|
- glob: ./scripts/test_node.sh
|
||||||
|
- glob: ./scripts/test_ics_node.sh
|
||||||
|
|
||||||
announce:
|
announce:
|
||||||
telegram:
|
telegram:
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
*out
|
||||||
|
*logs
|
||||||
|
*actions
|
||||||
|
*notifications
|
||||||
|
*tools
|
||||||
|
plugins
|
||||||
|
user_trunk.yaml
|
||||||
|
user.yaml
|
||||||
|
tmp
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
linters:
|
||||||
|
disable:
|
||||||
|
- unused # Disables unreachable code checking
|
||||||
|
|
||||||
|
run:
|
||||||
|
# Exclude test files from analysis
|
||||||
|
tests: false
|
||||||
|
|
||||||
|
# Define which files and directories to exclude
|
||||||
|
issues:
|
||||||
|
exclude-rules:
|
||||||
|
# Exclude all test files
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- all
|
||||||
|
|
||||||
|
# Exclude specific directories
|
||||||
|
exclude-dirs:
|
||||||
|
- api/did/v1
|
||||||
|
- api/dwn/v1
|
||||||
|
- api/svc/v1
|
||||||
|
- internal
|
||||||
|
|
||||||
|
# Exclude specific file patterns
|
||||||
|
exclude-files:
|
||||||
|
- ".*\\.pb\\.go$"
|
||||||
|
- ".*_templ\\.go$"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Following source doesn't work in most setups
|
||||||
|
ignored:
|
||||||
|
- SC1090
|
||||||
|
- SC1091
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Prettier friendly markdownlint config (all formatting rules disabled)
|
||||||
|
extends: markdownlint/style/prettier
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
edition = "2021"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
enable=all
|
||||||
|
source-path=SCRIPTDIR
|
||||||
|
disable=SC2154
|
||||||
|
|
||||||
|
# If you're having issues with shellcheck following source, disable the errors via:
|
||||||
|
# disable=SC1090
|
||||||
|
# disable=SC1091
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
rules:
|
||||||
|
quoted-strings:
|
||||||
|
required: only-when-needed
|
||||||
|
extra-allowed: ["{|}"]
|
||||||
|
key-duplicates: {}
|
||||||
|
octal-values:
|
||||||
|
forbid-implicit-octal: true
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
|
||||||
|
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
|
||||||
|
version: 0.1
|
||||||
|
cli:
|
||||||
|
version: 1.22.8
|
||||||
|
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
|
||||||
|
plugins:
|
||||||
|
sources:
|
||||||
|
- id: trunk
|
||||||
|
ref: v1.6.6
|
||||||
|
uri: https://github.com/trunk-io/plugins
|
||||||
|
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
|
||||||
|
runtimes:
|
||||||
|
enabled:
|
||||||
|
- go@1.23.0
|
||||||
|
- node@18.20.5
|
||||||
|
- python@3.10.8
|
||||||
|
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
|
||||||
|
lint:
|
||||||
|
enabled:
|
||||||
|
- actionlint@1.7.6
|
||||||
|
- checkov@3.2.347
|
||||||
|
- clippy@1.65.0
|
||||||
|
- git-diff-check
|
||||||
|
- gofmt@1.20.4
|
||||||
|
- golangci-lint@1.62.2
|
||||||
|
- hadolint@2.12.1-beta
|
||||||
|
# - markdownlint@0.43.0
|
||||||
|
- osv-scanner@1.9.2
|
||||||
|
- prettier@3.4.2
|
||||||
|
- rustfmt@1.65.0
|
||||||
|
# - shellcheck@0.10.0
|
||||||
|
# - shfmt@3.6.0
|
||||||
|
- taplo@0.9.3
|
||||||
|
- trufflehog@3.88.0
|
||||||
|
actions:
|
||||||
|
enabled:
|
||||||
|
- trunk-announce
|
||||||
|
- trunk-check-pre-push
|
||||||
|
- trunk-fmt-pre-commit
|
||||||
|
- trunk-upgrade-available
|
||||||
+684
@@ -0,0 +1,684 @@
|
|||||||
|
## v0.6.2 (2025-01-06)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- simplify release process and remove unnecessary tasks
|
||||||
|
- remove devcontainer configuration
|
||||||
|
|
||||||
|
## v0.6.1 (2024-12-30)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- convert highway sink schema to SQLite
|
||||||
|
- **scopes**: add Web Authentication API documentation
|
||||||
|
- add install script for Sonr binaries
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Handle only 500 errors in ErrorHandler
|
||||||
|
- Return only on 500 errors in error handler
|
||||||
|
- update sqlc queries to match schema and use SQLite conventions
|
||||||
|
- Rename DecodeWasmContext to decodeWasmContext
|
||||||
|
- resolve lint errors in WASMMiddleware function
|
||||||
|
- prevent automatic version bumps from dependabot
|
||||||
|
- correct merge workflow to increment patch version
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove outdated scopes
|
||||||
|
- remove unnecessary seed message
|
||||||
|
- Update sqlc queries to match schema and sqlite conventions
|
||||||
|
- move gateway and vault components to new locations
|
||||||
|
- **scopes**: simplify scopes.json structure
|
||||||
|
- **scopes**: rename and reorganize scopes
|
||||||
|
- **api**: remove unused Allocate RPC from Query service
|
||||||
|
- remove postgresql tasks
|
||||||
|
- remove unused AI PR body generator step
|
||||||
|
- simplify Taskfile and remove unused chain configurations
|
||||||
|
|
||||||
|
## v0.6.0 (2024-12-24)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- Add option to create draft issues from the new-issue script
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- rename DID, DWN, and SVC modules to core-dids, core-dwns, and core-svcs respectively
|
||||||
|
- rename MsgInitialize to MsgSpawn for clarity
|
||||||
|
- rename scopes in .github/scopes.json for better clarity
|
||||||
|
|
||||||
|
## v0.5.28 (2024-12-22)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Sink
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- update testnet configuration
|
||||||
|
- optimize GitHub Actions workflow triggers (#1204)
|
||||||
|
- Move embed
|
||||||
|
|
||||||
|
## v0.1.6 (2024-12-16)
|
||||||
|
|
||||||
|
## v0.5.26 (2024-12-13)
|
||||||
|
|
||||||
|
## v0.5.25 (2024-12-11)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- enable GoReleaser releases on tags and snapshots
|
||||||
|
- automate release on tag and workflow dispatch
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Correct regular expression for version tags in release workflow
|
||||||
|
|
||||||
|
## v0.5.24 (2024-12-11)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- prevent duplicate releases
|
||||||
|
|
||||||
|
## v0.5.23 (2024-12-11)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- rename scheduled release workflow to versioned release
|
||||||
|
- remove changelog from release artifacts
|
||||||
|
|
||||||
|
## v0.5.22 (2024-12-11)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- Implement passkey-based authentication and registration flow
|
||||||
|
- allow manual triggering of deployment workflow
|
||||||
|
- add start-tui command for interactive mode
|
||||||
|
- add coin selection and update passkey input in registration form
|
||||||
|
- add hway command for Sonr DID gateway
|
||||||
|
- Conditionally install process-compose only if binary not found
|
||||||
|
- Add process-compose support with custom start and down commands
|
||||||
|
- implement passkey registration flow
|
||||||
|
- Improve createProfile form layout with wider max-width and enhanced spacing
|
||||||
|
- improve index page UI with new navigation buttons and remove redundant settings buttons
|
||||||
|
- Make input rows responsive with grid layout for mobile and desktop
|
||||||
|
- enhance index page with additional settings buttons and style adjustments
|
||||||
|
- implement passkey-based authentication
|
||||||
|
- add support for Cloudsmith releases
|
||||||
|
- add go dependency and enhance devbox environment variables
|
||||||
|
- update create profile form placeholders and handle
|
||||||
|
- add DID-based authentication middleware
|
||||||
|
- Add validation for human verification slider sum in CreateProfile form
|
||||||
|
- implement passkey registration flow
|
||||||
|
- Update WebAuthn credential handling with modern browser standards
|
||||||
|
- Streamline passkey registration with automatic form submission
|
||||||
|
- Add credential parsing and logging in register finish handler
|
||||||
|
- Add credential details row with icon after passkey creation
|
||||||
|
- Add form validation for passkey credential input
|
||||||
|
- implement passkey registration flow
|
||||||
|
- Add hidden input to store passkey credential data for form submission
|
||||||
|
- add CI workflow for deploying network
|
||||||
|
- add hway binary support and Homebrew formula
|
||||||
|
- remove username from passkey creation
|
||||||
|
- implement passkey registration flow
|
||||||
|
- add passkey creation functionality
|
||||||
|
- add CNAME for onsonr.dev domain
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- use Unix domain sockets for devnet processes
|
||||||
|
- correct workflow name and improve devnet deployment process
|
||||||
|
- correct title of profile creation page
|
||||||
|
- rename devbox start script to up and remove stop script
|
||||||
|
- Consolidate archive configuration and add LICENSE file
|
||||||
|
- Improve cross-browser passkey credential handling and encoding
|
||||||
|
- Remove commented-out code in passkey registration script
|
||||||
|
- remove line-clamp from tailwind config
|
||||||
|
- remove unnecessary background and restart settings from process-compose.yaml
|
||||||
|
- suppress process-compose server output and log to file
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove unnecessary git fetch step in deploy workflow
|
||||||
|
- remove obsolete interchain test dependencies
|
||||||
|
- update index views to use new nebula components
|
||||||
|
- move Wasm related code to pkg/common/wasm
|
||||||
|
- migrate config package to pkg directory
|
||||||
|
- migrate to new configuration system and model definitions
|
||||||
|
- move session package to pkg directory
|
||||||
|
- Refactor registration forms to use UI components
|
||||||
|
- move gateway config to vault package
|
||||||
|
- improve command line flag descriptions and variable names
|
||||||
|
- refactor hway command to use echo framework for server
|
||||||
|
- Update root command to load EnvImpl from cobra flags
|
||||||
|
- Modify command flags and environment loading logic in cmds.go
|
||||||
|
- improve build process and move process-compose.yaml
|
||||||
|
- remove unused devbox.json and related configurations
|
||||||
|
- Improve mobile layout responsiveness for Rows and Columns components
|
||||||
|
- Remove max-w-fit from Rows component
|
||||||
|
- replace session package with context package
|
||||||
|
- rename database initialization function
|
||||||
|
- move session management to dedicated database module
|
||||||
|
- remove unused UI components related to wallet and index pages
|
||||||
|
- consolidate handlers into single files
|
||||||
|
- move gateway and vault packages to internal directory
|
||||||
|
- Move registration form components to dedicated directory
|
||||||
|
- remove unused devbox package
|
||||||
|
- remove devbox configuration
|
||||||
|
- move vault package to app directory
|
||||||
|
- improve code structure within gateway package
|
||||||
|
- move gateway package to app directory
|
||||||
|
- move vault package internal components to root
|
||||||
|
- migrate layout imports to common styles package
|
||||||
|
- Move form templates and styles to common directory
|
||||||
|
- consolidate authentication and DID handling logic
|
||||||
|
- Improve WebAuthn credential handling and validation in register finish route
|
||||||
|
- remove profile card component
|
||||||
|
- Simplify passkey registration UI and move profile component inline
|
||||||
|
- Update credential logging with transport and ID type
|
||||||
|
- Update register handler to use protocol.CredentialDescriptor struct
|
||||||
|
- Update credential handling to use protocol.CredentialDescriptor
|
||||||
|
- improve profile card styling and functionality
|
||||||
|
- Simplify session management and browser information extraction
|
||||||
|
- Update PeerInfo to extract and store comprehensive device information
|
||||||
|
- improve address display in property details
|
||||||
|
- remove unused documentation generation script
|
||||||
|
- replace sonr/pkg/styles/layout with nebula/ui/layout
|
||||||
|
- migrate UI components to nebula module
|
||||||
|
- improve scopes.json structure and update scripts for better usability
|
||||||
|
|
||||||
|
## v0.5.20 (2024-12-07)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- simplify CI workflow by removing redundant asset publishing steps
|
||||||
|
|
||||||
|
## v0.5.19 (2024-12-06)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add support for parent field and resources list in Capability message
|
||||||
|
- add fast reflection methods for Capability and Resource
|
||||||
|
- add gum package and update devbox configuration
|
||||||
|
- add new button components and layout improvements
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- adjust fullscreen modal close button margin
|
||||||
|
- update devbox lockfile
|
||||||
|
- resolve rendering issue in login modal
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- rename accaddr package to address
|
||||||
|
- Update Credential table to match WebAuthn Credential Descriptor
|
||||||
|
- Deployment setup
|
||||||
|
- migrate build system from Taskfile to Makefile
|
||||||
|
- rename Assertion to Account and update related code
|
||||||
|
- remove unused TUI components
|
||||||
|
- Move IPFS interaction functions to common package
|
||||||
|
- remove dependency on DWN.pkl
|
||||||
|
- remove unused dependencies and simplify module imports
|
||||||
|
- Rename x/vault -> x/dwn and x/service -> x/svc
|
||||||
|
- move resolver formatter to services package
|
||||||
|
- remove web documentation
|
||||||
|
- update devbox configuration and scripts
|
||||||
|
- rename layout component to root
|
||||||
|
- refactor authentication pages into their own modules
|
||||||
|
- update templ version to v0.2.778 and remove unused air config
|
||||||
|
- move signer implementation to mpc package
|
||||||
|
|
||||||
|
## v0.5.18 (2024-11-06)
|
||||||
|
|
||||||
|
## v0.5.17 (2024-11-05)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add remote client constructor
|
||||||
|
- add avatar image components
|
||||||
|
- add SVG CDN Illustrations to marketing architecture
|
||||||
|
- **marketing**: refactor marketing page components
|
||||||
|
- Refactor intro video component to use a proper script template
|
||||||
|
- Move Alpine.js script initialization to separate component
|
||||||
|
- Add intro video modal component
|
||||||
|
- add homepage architecture section
|
||||||
|
- add Hero section component with stats and buttons
|
||||||
|
- **css**: add new utility classes for group hover
|
||||||
|
- implement authentication register finish endpoint
|
||||||
|
- add controller creation step to allocate
|
||||||
|
- Update service module README based on protobuf files
|
||||||
|
- Update x/macaroon/README.md with details from protobuf files
|
||||||
|
- update Vault README with details from proto files
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update file paths in error messages
|
||||||
|
- update intro video modal script
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- update marketing section architecture
|
||||||
|
- change verification table id
|
||||||
|
- **proto**: remove macaroon proto
|
||||||
|
- rename ValidateBasic to Validate
|
||||||
|
- rename session cookie key
|
||||||
|
- remove unused sync-initial endpoint
|
||||||
|
- remove formatter.go from service module
|
||||||
|
|
||||||
|
## v0.5.16 (2024-10-21)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- include assets generation in wasm build
|
||||||
|
|
||||||
|
## v0.5.15 (2024-10-21)
|
||||||
|
|
||||||
|
## v0.5.14 (2024-10-21)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove StakingKeeper dependency from GlobalFeeDecorator
|
||||||
|
|
||||||
|
## v0.5.13 (2024-10-21)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add custom secp256k1 pubkey
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- update gRPC client to use new request types
|
||||||
|
- use RawPublicKey instead of PublicKey in macaroon issuer
|
||||||
|
- improve error handling in DID module
|
||||||
|
|
||||||
|
## v0.5.12 (2024-10-18)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add User-Agent and Platform to session
|
||||||
|
- introduce AuthState enum for authentication state
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- **version**: revert version bump to 0.5.11
|
||||||
|
- **version**: update version to 0.5.12
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove dependency on proto change detection
|
||||||
|
- update asset publishing configuration
|
||||||
|
|
||||||
|
## v0.5.11 (2024-10-10)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- nebula assets served from CDN
|
||||||
|
- use CDN for nebula frontend assets
|
||||||
|
- add static hero section content to homepage
|
||||||
|
- add wrangler scripts for development, build, and deployment
|
||||||
|
- remove build configuration
|
||||||
|
- move gateway web code to dedicated directory
|
||||||
|
- add PubKey fast reflection
|
||||||
|
- **macaroon**: add transaction allowlist/denylist caveats
|
||||||
|
- add PR labeler
|
||||||
|
- **devbox**: remove hway start command
|
||||||
|
- add GitHub Actions workflow for running tests
|
||||||
|
- add workflow for deploying Hway to Cloudflare Workers
|
||||||
|
- Publish configs to R2
|
||||||
|
- integrate nebula UI with worker-assets-gen
|
||||||
|
- extract reusable layout components
|
||||||
|
- Implement service worker for IPFS vault
|
||||||
|
- implement CDN support for assets
|
||||||
|
- add payment method support
|
||||||
|
- add support for public key management
|
||||||
|
- add ModalForm component
|
||||||
|
- add LoginStart and RegisterStart routes
|
||||||
|
- implement authentication views
|
||||||
|
- add json tags to config structs
|
||||||
|
- implement templ forms for consent privacy, credential assert, credential register, and profile details
|
||||||
|
- **vault**: introduce assembly of the initial vault
|
||||||
|
- add client logos to homepage
|
||||||
|
- add tailwind utility classes
|
||||||
|
- implement new profile card component
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Correct source directory for asset publishing
|
||||||
|
- install dependencies before nebula build
|
||||||
|
- update Schema service to use new API endpoint
|
||||||
|
- fix broken logo image path
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove unnecessary branch configuration from scheduled release workflow
|
||||||
|
- update dwn configuration generation import path
|
||||||
|
- use nebula/routes instead of nebula/global
|
||||||
|
- move index template to routes package
|
||||||
|
- remove cdn package and move assets to global styles
|
||||||
|
- move nebula assets to hway build directory
|
||||||
|
- remove docker build and deployment
|
||||||
|
- rename internal/session package to internal/ctx
|
||||||
|
- remove unused fields from
|
||||||
|
- rename PR_TEMPLATE to PULL_REQUEST_TEMPLATE
|
||||||
|
- remove devbox.json init hook
|
||||||
|
- rename sonrd dockerfile to Dockerfile
|
||||||
|
- remove unused dependency
|
||||||
|
- rename 'global/cdn' to 'assets'
|
||||||
|
- move CDN assets to separate folder
|
||||||
|
- move Pkl module definitions to dedicated package
|
||||||
|
- move CDN assets to js/ folder
|
||||||
|
- remove unused component templates
|
||||||
|
- move ui components to global
|
||||||
|
- move view handlers to router package
|
||||||
|
|
||||||
|
## v0.5.10 (2024-10-07)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- **blocks**: remove button component
|
||||||
|
|
||||||
|
## v0.5.9 (2024-10-06)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add Motr support
|
||||||
|
- update UIUX PKL to utilize optional fields
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Update source directory for asset publishing
|
||||||
|
|
||||||
|
## v0.5.8 (2024-10-04)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- Remove unused logs configuration
|
||||||
|
|
||||||
|
## v0.5.7 (2024-10-04)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- **devbox**: use process-compose for testnet services
|
||||||
|
- remove motr.mjs dependency
|
||||||
|
- add markdown rendering to issue templates
|
||||||
|
- update issue templates for better clarity
|
||||||
|
- add issue templates for tracking and task issues
|
||||||
|
- add issue templates for bug report and tracking
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- update issue template headings
|
||||||
|
- rename bug-report issue template to bug
|
||||||
|
|
||||||
|
## v0.5.6 (2024-10-03)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- introduce docker-compose based setup
|
||||||
|
- add hway and sonr processes to dev environment
|
||||||
|
|
||||||
|
## v0.5.5 (2024-10-03)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add rudimentary DidController table
|
||||||
|
- update home section with new features
|
||||||
|
- introduce Home model and refactor views
|
||||||
|
- **nebula**: create Home model for home page
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- reorganize pkl files for better separation of concerns
|
||||||
|
- rename msg_server_test.go to rpc_test.go
|
||||||
|
|
||||||
|
## v0.5.4 (2024-10-02)
|
||||||
|
|
||||||
|
## v0.5.3 (2024-10-02)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- remove unnecessary telegram message template
|
||||||
|
|
||||||
|
## v0.5.2 (2024-10-02)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- **service**: integrate group module (#1104)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- revert version bump to 0.5.1
|
||||||
|
|
||||||
|
## v0.5.1 (2024-10-02)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- move Motr API to state package
|
||||||
|
|
||||||
|
## v0.5.0 (2024-10-02)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- allow multiple macaroons with the same id
|
||||||
|
|
||||||
|
## v0.4.5 (2024-10-02)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- **release**: add docker images for sonrd and motr
|
||||||
|
- update homepage with new visual design
|
||||||
|
- add DID to vault genesis schema
|
||||||
|
- add video component
|
||||||
|
- add video component
|
||||||
|
- add hx-get attribute to primary button in hero section
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- use correct secret for docker login
|
||||||
|
- **layout**: add missing favicon
|
||||||
|
- **hero**: Use hx-swap for primary button to prevent flicker
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- use single GITHUB_TOKEN for release workflow
|
||||||
|
- update workflow variables
|
||||||
|
|
||||||
|
## v0.4.2 (2024-10-01)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- use single GITHUB_TOKEN for release workflow
|
||||||
|
|
||||||
|
## v0.4.1 (2024-10-01)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- Implement session management
|
||||||
|
- allow manual release triggers
|
||||||
|
- add Input and RegistrationForm models
|
||||||
|
- add new utility classes
|
||||||
|
- add login and registration pages
|
||||||
|
- add tailwindcss utilities
|
||||||
|
- add support for ARM64 architecture
|
||||||
|
- add DWN resolver field
|
||||||
|
- add stats section to homepage
|
||||||
|
- implement hero section using Pkl
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- **version**: update version number to 0.4.0
|
||||||
|
- update release workflow to use latest tag
|
||||||
|
- **versioning**: revert version to 0.9.0
|
||||||
|
- **cta**: Fix typo in CTA title
|
||||||
|
- change bento section title to reflect security focus
|
||||||
|
- adjust hero image dimensions
|
||||||
|
- **Input**: Change type from to
|
||||||
|
- update hero image height in config.pkl
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- move home page sections to home package
|
||||||
|
- rename motrd to motr
|
||||||
|
- update hero image dimensions
|
||||||
|
- move nebula configuration to static file
|
||||||
|
|
||||||
|
## v0.4.0 (2024-09-30)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add PKL schema for message formats
|
||||||
|
- add Homebrew tap for sonr
|
||||||
|
- update release workflow to use latest tag
|
||||||
|
- **dwn**: add wasm build for dwn
|
||||||
|
- add macaroon and oracle genesis states
|
||||||
|
- add scheduled binary release workflow
|
||||||
|
- introduce process-compose for process management
|
||||||
|
- add counter animation to hero section
|
||||||
|
- add registration page
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- Enable scheduled release workflow
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove old changelog entries
|
||||||
|
- rename buf-publish.yml to publish-assets.yml
|
||||||
|
- remove unused field from
|
||||||
|
- remove unnecessary checkout in scheduled-release workflow
|
||||||
|
- rename build ID to sonr
|
||||||
|
- remove unnecessary release existence check
|
||||||
|
- move dwn wasm build to pkg directory
|
||||||
|
|
||||||
|
## v0.3.1 (2024-09-29)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- move nebula/pages to pkg/nebula/pages
|
||||||
|
|
||||||
|
## v0.3.0 (2024-09-29)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add buf.lock for proto definitions
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- remove unused linting rules
|
||||||
|
- update proto breaking check target to master branch
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- remove unused lock files and configurations
|
||||||
|
|
||||||
|
## v0.2.0 (2024-09-29)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- disable goreleaser workflow
|
||||||
|
- update workflows to include master branch
|
||||||
|
- remove global style declaration
|
||||||
|
- **oracle**: add oracle module
|
||||||
|
- optimize IPFS configuration for better performance
|
||||||
|
- add local IPFS bootstrap script and refactor devbox config
|
||||||
|
- add AllocateVault HTTP endpoint
|
||||||
|
- add WebAuthn credential management functionality
|
||||||
|
- remove unused coins interface
|
||||||
|
- remove global integrity proof from genesis state
|
||||||
|
- add vault module
|
||||||
|
- enable buf.build publishing on master and develop branches
|
||||||
|
- add Gitflow workflow for syncing branches
|
||||||
|
- add automated production release workflow
|
||||||
|
- **ui**: implement profile page
|
||||||
|
- add automated production release workflow
|
||||||
|
- **did**: remove unused proto files
|
||||||
|
- add enums.pulsar.go file for PermissionScope enum (#4)
|
||||||
|
- add initial DID implementation
|
||||||
|
- remove builder interface
|
||||||
|
- add basic UI for block explorer
|
||||||
|
- add Usage: pkl [OPTIONS] COMMAND [ARGS]...
|
||||||
|
- use SQLite embedded driver
|
||||||
|
- add DID method for each coin
|
||||||
|
- Expand KeyType enum and update KeyInfo message in genesis.proto
|
||||||
|
- Add whitelisted key types to genesis params
|
||||||
|
- Add DID grants protobuf definition
|
||||||
|
- Add fields to KeyInfo struct to distinguish CBOR and standard blockchain key types
|
||||||
|
- Add new message types for AssetInfo, ChainInfo, Endpoint, ExplorerInfo, FeeInfo, and KeyInfo
|
||||||
|
- run sonr-node container in testnet network and make network external
|
||||||
|
- Add docker-compose.yaml file to start a Sonr testnet node
|
||||||
|
- configure Sonr testnet environment
|
||||||
|
- Update Dockerfile to start and run a testnet
|
||||||
|
- add Equal methods for AssetInfo and ChainInfo types
|
||||||
|
- Add ProveWitness and SyncVault RPCs
|
||||||
|
- Add MsgRegisterService to handle service registration
|
||||||
|
- Add MsgRegisterService to handle service registration
|
||||||
|
- add enums.pulsar.go file for PermissionScope enum
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- ensure go version is up-to-date
|
||||||
|
- use GITHUB_TOKEN for version bump workflow
|
||||||
|
- update account table interface to use address, chain and network
|
||||||
|
- **ci**: update docker vm release workflow with new token
|
||||||
|
- use mnemonic phrases for test account keys
|
||||||
|
- reduce motr proxy shutdown timeout
|
||||||
|
- **nebula**: use bunx for tailwindcss build
|
||||||
|
- **proto**: update protobuf message index numbers
|
||||||
|
- **ante**: reduce POA rate floor and ceiling
|
||||||
|
- Update proc_list_width in mprocs.yaml
|
||||||
|
- Add service to database when registering
|
||||||
|
- pin added did documents to local ipfs node
|
||||||
|
- remove extra spaces in typeUrl
|
||||||
|
- **release**: remove unnecessary quotes in tag pattern
|
||||||
|
- remove unused imports and simplify KeyInfo message
|
||||||
|
- bind node ports to localhost
|
||||||
|
- Update docker-compose network name to dokploy-network
|
||||||
|
- Update network name to dokploy
|
||||||
|
- remove unused port mapping
|
||||||
|
- Update docker-compose.yaml to use correct volume path
|
||||||
|
- update docker-compose volume name
|
||||||
|
- Update docker-compose.yaml to use shell directly for sonrd command
|
||||||
|
- replace "sh" with "/bin/sh" in docker-compose.yaml command
|
||||||
|
- Update runner image dependencies for debian-11
|
||||||
|
- **deps**: update golang image to 1.21
|
||||||
|
- **chains**: update nomic chain build target
|
||||||
|
- Remove unused `Meta` message from `genesis.proto`
|
||||||
|
- Add ProveWitness and SyncVault RPCs
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- adjust source directory for config files (#1102)
|
||||||
|
- Use actions/checkout@v4
|
||||||
|
- remove unused master branch from CI workflow
|
||||||
|
- rename github token secret
|
||||||
|
- remove unnecessary x-cloak styles
|
||||||
|
- optimize oracle genesis proto
|
||||||
|
- remove unused code related to whitelisted assets
|
||||||
|
- update buf publish source directory
|
||||||
|
- adjust devbox configuration to reflect nebula changes
|
||||||
|
- rename msg_server.go to rpc.go
|
||||||
|
- remove devbox integration
|
||||||
|
- move dwn package to app/config
|
||||||
|
- move configuration files to app directory
|
||||||
|
- extract root command creation to separate file
|
||||||
|
- move ipfs setup to function
|
||||||
|
- remove unnecessary proxy config
|
||||||
|
- rename script to
|
||||||
|
- move DWN proxy server logic to separate file
|
||||||
|
- use htmx instead of dwn for vault client
|
||||||
|
- remove unused environment variables
|
||||||
|
- simplify verification method structure
|
||||||
|
- use staking keeper in DID keeper
|
||||||
|
- remove unused dependencies
|
||||||
|
- remove unused image building workflow
|
||||||
|
- add field to
|
||||||
|
- Update KeyKind Enum to have proper naming conventions
|
||||||
|
- Update `DIDNamespace` to have proper naming convention
|
||||||
|
- expose ports directly in docker-compose
|
||||||
|
- remove unused port mappings
|
||||||
|
- streamline script execution
|
||||||
|
- use CMD instead of ENTRYPOINT in Dockerfile
|
||||||
|
- **deps**: Upgrade Debian base image to 11
|
||||||
|
- Simplify the types and properties to keep a consistent structure for the blockchain
|
||||||
|
- remove PERMISSION_SCOPE_IDENTIFIERS_ENS enum value
|
||||||
+3
-38
@@ -1,41 +1,4 @@
|
|||||||
FROM jetpackio/devbox:latest AS sonrvm
|
FROM golang:1.23-alpine AS go-builder
|
||||||
|
|
||||||
# Installing your devbox project
|
|
||||||
WORKDIR /code
|
|
||||||
USER root:root
|
|
||||||
|
|
||||||
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
|
|
||||||
|
|
||||||
USER ${DEVBOX_USER}:${DEVBOX_USER}
|
|
||||||
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
|
|
||||||
|
|
||||||
RUN devbox run -- echo "Installed Packages."
|
|
||||||
|
|
||||||
ENTRYPOINT ["devbox", "run"]
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
|
||||||
FROM jetpackio/devbox:latest AS sonr-runner
|
|
||||||
|
|
||||||
WORKDIR /code
|
|
||||||
USER root:root
|
|
||||||
|
|
||||||
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
|
|
||||||
|
|
||||||
USER ${DEVBOX_USER}:${DEVBOX_USER}
|
|
||||||
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
|
|
||||||
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . .
|
|
||||||
|
|
||||||
RUN devbox run -- echo "Installed Packages."
|
|
||||||
|
|
||||||
RUN git config --global --add safe.directory /code
|
|
||||||
ENTRYPOINT ["devbox", "run", "testnet"]
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
|
||||||
FROM golang:1.22-alpine AS go-builder
|
|
||||||
|
|
||||||
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
|
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
|
||||||
|
|
||||||
@@ -68,6 +31,8 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
|
|||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
FROM debian:11-slim
|
FROM debian:11-slim
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/onsonr/sonr
|
||||||
|
|
||||||
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
|
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
|
||||||
|
|
||||||
# Install dependencies for Debian 11
|
# Install dependencies for Debian 11
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
|
|||||||
BINDIR ?= $(GOPATH)/bin
|
BINDIR ?= $(GOPATH)/bin
|
||||||
SIMAPP = ./app
|
SIMAPP = ./app
|
||||||
|
|
||||||
PC_PORT_NUM=42069
|
# Fetch from env
|
||||||
PC_LOG_FILE=./sonr.log
|
RELEASE_DATE ?= $(shell date +%Y).$(shell date +%V).$(shell date +%u)
|
||||||
PC_SOCKET_PATH=/tmp/sonr-net.sock
|
VERSION ?= $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
||||||
|
COMMIT ?= $(shell git log -1 --format='%H')
|
||||||
|
OS ?= $(shell uname -s)
|
||||||
|
ROOT ?= $(shell git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# for dockerized protobuf tools
|
# for dockerized protobuf tools
|
||||||
DOCKER := $(shell which docker)
|
DOCKER := $(shell which docker)
|
||||||
HTTPS_GIT := github.com/onsonr/sonr.git
|
HTTPS_GIT := github.com/onsonr/sonr.git
|
||||||
PROCESS_COMPOSE := $(shell which process-compose)
|
|
||||||
|
|
||||||
export GO111MODULE = on
|
export GO111MODULE = on
|
||||||
|
|
||||||
@@ -75,8 +77,6 @@ ldflags := $(strip $(ldflags))
|
|||||||
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
||||||
|
|
||||||
# The below include contains the tools and runsim targets.
|
# The below include contains the tools and runsim targets.
|
||||||
include contrib/devtools/Makefile
|
|
||||||
|
|
||||||
all: install lint test
|
all: install lint test
|
||||||
|
|
||||||
build: go.sum
|
build: go.sum
|
||||||
@@ -87,6 +87,12 @@ else
|
|||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd ./cmd/sonrd
|
go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd ./cmd/sonrd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
build-motr: go.sum
|
||||||
|
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
|
||||||
|
|
||||||
|
build-hway: go.sum
|
||||||
|
go build -o build/hway ./cmd/hway
|
||||||
|
|
||||||
build-windows-client: go.sum
|
build-windows-client: go.sum
|
||||||
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd.exe ./cmd/sonrd
|
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd.exe ./cmd/sonrd
|
||||||
|
|
||||||
@@ -100,8 +106,17 @@ endif
|
|||||||
install: go.sum
|
install: go.sum
|
||||||
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
|
||||||
|
|
||||||
|
install-hway: go.sum
|
||||||
|
go install -mod=readonly ./cmd/hway
|
||||||
|
|
||||||
|
release: fmt-date
|
||||||
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
RELEASE_DATE=$(RELEASE_DATE) goreleaser release --clean
|
||||||
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Tools & dependencies
|
### Tools & dependencies
|
||||||
|
########################################
|
||||||
|
|
||||||
go-mod-cache: go.sum
|
go-mod-cache: go.sum
|
||||||
@echo "--> Download go modules to local cache"
|
@echo "--> Download go modules to local cache"
|
||||||
@@ -127,12 +142,9 @@ clean:
|
|||||||
distclean: clean
|
distclean: clean
|
||||||
rm -rf vendor/
|
rm -rf vendor/
|
||||||
|
|
||||||
init-env:
|
|
||||||
@echo "Installing process-compose"
|
|
||||||
sh scripts/init_env.sh
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Testing
|
### Testing
|
||||||
|
########################################
|
||||||
|
|
||||||
test: test-unit
|
test: test-unit
|
||||||
test-all: test-race test-cover test-system
|
test-all: test-race test-cover test-system
|
||||||
@@ -301,74 +313,41 @@ testnet-basic: setup-testnet
|
|||||||
sh-testnet: mod-tidy
|
sh-testnet: mod-tidy
|
||||||
CHAIN_ID="sonr-testnet-1" BLOCK_TIME="1000ms" CLEAN=true sh scripts/test_node.sh
|
CHAIN_ID="sonr-testnet-1" BLOCK_TIME="1000ms" CLEAN=true sh scripts/test_node.sh
|
||||||
|
|
||||||
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet
|
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet dop-testnet
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### generation ###
|
### extra utils ###
|
||||||
###############################################################################
|
|
||||||
.PHONY: gen-pkl gen-templ gen-sqlc
|
|
||||||
|
|
||||||
gen-pkl: init-env
|
|
||||||
pkl-gen-go pkl/sonr.orm/UCAN.pkl
|
|
||||||
pkl-gen-go pkl/sonr.orm/Models.pkl
|
|
||||||
pkl-gen-go pkl/sonr.net/Hway.pkl
|
|
||||||
pkl-gen-go pkl/sonr.net/Motr.pkl
|
|
||||||
|
|
||||||
gen-sqlc: init-env
|
|
||||||
@cd internal/database && sqlc generate
|
|
||||||
|
|
||||||
gen-templ: init-env
|
|
||||||
@templ generate
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### custom builds ###
|
|
||||||
###############################################################################
|
|
||||||
.PHONY: build-motr build-hway logs-hway logs-sonr
|
|
||||||
|
|
||||||
build-motr:
|
|
||||||
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
|
|
||||||
|
|
||||||
build-hway: gen-templ
|
|
||||||
go build -o build/hway ./cmd/hway
|
|
||||||
|
|
||||||
logs-hway: init-env
|
|
||||||
bin/process-compose process logs hway --port $(PC_PORT_NUM) --follow
|
|
||||||
|
|
||||||
logs-sonr: init-env
|
|
||||||
bin/process-compose process logs sonr --port $(PC_PORT_NUM) --follow
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Network Start/Stop ###
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
.PHONY: deploy start start-tui start-uds stop stop-uds restart status
|
push-docker:
|
||||||
|
@docker build -t ghcr.io/onsonr/sonr:latest .
|
||||||
|
@docker tag ghcr.io/onsonr/sonr:latest ghcr.io/onsonr/sonr:$(VERSION)
|
||||||
|
@docker push ghcr.io/onsonr/sonr:latest
|
||||||
|
@docker push ghcr.io/onsonr/sonr:$(VERSION)
|
||||||
|
|
||||||
start: build-hway init-env
|
status:
|
||||||
bin/process-compose up --port $(PC_PORT_NUM) --log-file $(PC_LOG_FILE) -f deploy/process-compose.yaml
|
@gh run ls -L 3
|
||||||
|
@gum format -- "# Sonr ($OS-$VERSION)" "- ($(COMMIT)) $ROOT" "- $(RELEASE_DATE)"
|
||||||
|
@sleep 3
|
||||||
|
|
||||||
start-uds: build-hway init-env
|
release:
|
||||||
bin/process-compose up --use-uds --unix-socket $(PC_SOCKET_PATH) --log-file $(PC_LOG_FILE) --detached -f deploy/process-compose.yaml
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser release --clean
|
||||||
|
|
||||||
stop: init-env
|
release-dry:
|
||||||
bin/process-compose down --port $(PC_PORT_NUM)
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser release --snapshot --clean --skip=publish
|
||||||
|
|
||||||
stop-uds: init-env
|
release-check:
|
||||||
bin/process-compose down --use-uds --unix-socket $(PC_SOCKET_PATH)
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser check
|
||||||
|
|
||||||
status: init-env
|
validate-tag:
|
||||||
bin/process-compose project state --port $(PC_PORT_NUM)
|
@sh ./scripts/validate_tag.sh
|
||||||
|
|
||||||
status-uds: init-env
|
|
||||||
bin/process-compose project state --use-uds --unix-socket $(PC_SOCKET_PATH)
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### help ###
|
### help ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
deploy:
|
|
||||||
cd ./proto && bunx buf dep update && bunx buf build && bunx buf push
|
|
||||||
sh ./.github/scripts/upload_cdn.sh
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage: make <target>"
|
@echo "Usage: make <target>"
|
||||||
@echo ""
|
@echo ""
|
||||||
@@ -380,7 +359,5 @@ help:
|
|||||||
@echo " sh-testnet : Shell local devnet"
|
@echo " sh-testnet : Shell local devnet"
|
||||||
@echo " ictest-basic : Basic end-to-end test"
|
@echo " ictest-basic : Basic end-to-end test"
|
||||||
@echo " ictest-ibc : IBC end-to-end test"
|
@echo " ictest-ibc : IBC end-to-end test"
|
||||||
@echo " templ : Generate templ files"
|
|
||||||
@echo " vault : Build vault.wasm"
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|||||||
@@ -37,4 +37,3 @@ Sonr would not have been possible without the direct and indirect support of the
|
|||||||
- [Forum](https://github.com/onsonr/sonr/discussions)
|
- [Forum](https://github.com/onsonr/sonr/discussions)
|
||||||
- [Issues](https://github.com/onsonr/sonr/issues)
|
- [Issues](https://github.com/onsonr/sonr/issues)
|
||||||
- [Twitter](https://sonr.io/twitter)
|
- [Twitter](https://sonr.io/twitter)
|
||||||
- [Dev Chat](https://sonr.io/discord)
|
|
||||||
|
|||||||
+2515
-427
File diff suppressed because it is too large
Load Diff
+747
-2417
File diff suppressed because it is too large
Load Diff
+28
-3253
File diff suppressed because it is too large
Load Diff
+1
-127
@@ -19,10 +19,7 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Query_Params_FullMethodName = "/dwn.v1.Query/Params"
|
Query_Params_FullMethodName = "/dwn.v1.Query/Params"
|
||||||
Query_Schema_FullMethodName = "/dwn.v1.Query/Schema"
|
|
||||||
Query_Allocate_FullMethodName = "/dwn.v1.Query/Allocate"
|
|
||||||
Query_Sync_FullMethodName = "/dwn.v1.Query/Sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// QueryClient is the client API for Query service.
|
// QueryClient is the client API for Query service.
|
||||||
@@ -33,15 +30,6 @@ const (
|
|||||||
type QueryClient interface {
|
type QueryClient interface {
|
||||||
// Params queries all parameters of the module.
|
// Params queries all parameters of the module.
|
||||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||||
// Schema queries the DID document by its id. And returns the required PKL
|
|
||||||
// information
|
|
||||||
Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error)
|
|
||||||
// Allocate initializes a Target Vault available for claims with a compatible
|
|
||||||
// Authentication mechanism. The default authentication mechanism is WebAuthn.
|
|
||||||
Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error)
|
|
||||||
// Sync queries the DID document by its id. And returns the required PKL
|
|
||||||
// information
|
|
||||||
Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type queryClient struct {
|
type queryClient struct {
|
||||||
@@ -62,36 +50,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(QuerySchemaResponse)
|
|
||||||
err := c.cc.Invoke(ctx, Query_Schema_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *queryClient) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(QueryAllocateResponse)
|
|
||||||
err := c.cc.Invoke(ctx, Query_Allocate_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(QuerySyncResponse)
|
|
||||||
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryServer is the server API for Query service.
|
// QueryServer is the server API for Query service.
|
||||||
// All implementations must embed UnimplementedQueryServer
|
// All implementations must embed UnimplementedQueryServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@@ -100,15 +58,6 @@ func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...gr
|
|||||||
type QueryServer interface {
|
type QueryServer interface {
|
||||||
// Params queries all parameters of the module.
|
// Params queries all parameters of the module.
|
||||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||||
// Schema queries the DID document by its id. And returns the required PKL
|
|
||||||
// information
|
|
||||||
Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error)
|
|
||||||
// Allocate initializes a Target Vault available for claims with a compatible
|
|
||||||
// Authentication mechanism. The default authentication mechanism is WebAuthn.
|
|
||||||
Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error)
|
|
||||||
// Sync queries the DID document by its id. And returns the required PKL
|
|
||||||
// information
|
|
||||||
Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error)
|
|
||||||
mustEmbedUnimplementedQueryServer()
|
mustEmbedUnimplementedQueryServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,15 +71,6 @@ type UnimplementedQueryServer struct{}
|
|||||||
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedQueryServer) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedQueryServer) Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedQueryServer) Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||||
func (UnimplementedQueryServer) testEmbeddedByValue() {}
|
func (UnimplementedQueryServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@@ -170,60 +110,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(QuerySchemaRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(QueryServer).Schema(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: Query_Schema_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(QueryServer).Schema(ctx, req.(*QuerySchemaRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(QueryAllocateRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(QueryServer).Allocate(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: Query_Allocate_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(QueryServer).Allocate(ctx, req.(*QueryAllocateRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(QuerySyncRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(QueryServer).Sync(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: Query_Sync_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(QueryServer).Sync(ctx, req.(*QuerySyncRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -235,18 +121,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "Params",
|
MethodName: "Params",
|
||||||
Handler: _Query_Params_Handler,
|
Handler: _Query_Params_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "Schema",
|
|
||||||
Handler: _Query_Schema_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Allocate",
|
|
||||||
Handler: _Query_Allocate_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Sync",
|
|
||||||
Handler: _Query_Sync_Handler,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "dwn/v1/query.proto",
|
Metadata: "dwn/v1/query.proto",
|
||||||
|
|||||||
@@ -1818,7 +1818,7 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_dwn_v1_tx_proto_rawDescGZIP(), []int{1}
|
return file_dwn_v1_tx_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgInitialize spawns a New Vault with Unclaimed State. This is a one-time
|
// MsgSpawn spawns a New Vault with Unclaimed State. This is a one-time
|
||||||
// operation that must be performed interacting with the Vault.
|
// operation that must be performed interacting with the Vault.
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.47
|
// Since: cosmos-sdk 0.47
|
||||||
@@ -1869,8 +1869,8 @@ func (x *MsgInitialize) GetParams() *Params {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgInitializeResponse defines the response structure for executing a
|
// MsgSpawnResponse defines the response structure for executing a
|
||||||
// MsgInitialize message.
|
// MsgSpawn message.
|
||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.47
|
// Since: cosmos-sdk 0.47
|
||||||
type MsgInitializeResponse struct {
|
type MsgInitializeResponse struct {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type MsgClient interface {
|
|||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.47
|
// Since: cosmos-sdk 0.47
|
||||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||||
// Initialize spawns a new Vault
|
// Spawn spawns a new Vault
|
||||||
Initialize(ctx context.Context, in *MsgInitialize, opts ...grpc.CallOption) (*MsgInitializeResponse, error)
|
Initialize(ctx context.Context, in *MsgInitialize, opts ...grpc.CallOption) (*MsgInitializeResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ type MsgServer interface {
|
|||||||
//
|
//
|
||||||
// Since: cosmos-sdk 0.47
|
// Since: cosmos-sdk 0.47
|
||||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||||
// Initialize spawns a new Vault
|
// Spawn spawns a new Vault
|
||||||
Initialize(context.Context, *MsgInitialize) (*MsgInitializeResponse, error)
|
Initialize(context.Context, *MsgInitialize) (*MsgInitializeResponse, error)
|
||||||
mustEmbedUnimplementedMsgServer()
|
mustEmbedUnimplementedMsgServer()
|
||||||
}
|
}
|
||||||
|
|||||||
+1475
-498
File diff suppressed because it is too large
Load Diff
+1949
-28
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,9 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Query_Params_FullMethodName = "/svc.v1.Query/Params"
|
Query_Params_FullMethodName = "/svc.v1.Query/Params"
|
||||||
|
Query_OriginExists_FullMethodName = "/svc.v1.Query/OriginExists"
|
||||||
|
Query_ResolveOrigin_FullMethodName = "/svc.v1.Query/ResolveOrigin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QueryClient is the client API for Query service.
|
// QueryClient is the client API for Query service.
|
||||||
@@ -30,6 +32,10 @@ const (
|
|||||||
type QueryClient interface {
|
type QueryClient interface {
|
||||||
// Params queries all parameters of the module.
|
// Params queries all parameters of the module.
|
||||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||||
|
// OriginExists queries if a given origin exists.
|
||||||
|
OriginExists(ctx context.Context, in *QueryOriginExistsRequest, opts ...grpc.CallOption) (*QueryOriginExistsResponse, error)
|
||||||
|
// ResolveOrigin queries the domain of a given service and returns its record with capabilities.
|
||||||
|
ResolveOrigin(ctx context.Context, in *QueryResolveOriginRequest, opts ...grpc.CallOption) (*QueryResolveOriginResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type queryClient struct {
|
type queryClient struct {
|
||||||
@@ -50,6 +56,26 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *queryClient) OriginExists(ctx context.Context, in *QueryOriginExistsRequest, opts ...grpc.CallOption) (*QueryOriginExistsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryOriginExistsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, Query_OriginExists_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *queryClient) ResolveOrigin(ctx context.Context, in *QueryResolveOriginRequest, opts ...grpc.CallOption) (*QueryResolveOriginResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryResolveOriginResponse)
|
||||||
|
err := c.cc.Invoke(ctx, Query_ResolveOrigin_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// QueryServer is the server API for Query service.
|
// QueryServer is the server API for Query service.
|
||||||
// All implementations must embed UnimplementedQueryServer
|
// All implementations must embed UnimplementedQueryServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@@ -58,6 +84,10 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
|||||||
type QueryServer interface {
|
type QueryServer interface {
|
||||||
// Params queries all parameters of the module.
|
// Params queries all parameters of the module.
|
||||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||||
|
// OriginExists queries if a given origin exists.
|
||||||
|
OriginExists(context.Context, *QueryOriginExistsRequest) (*QueryOriginExistsResponse, error)
|
||||||
|
// ResolveOrigin queries the domain of a given service and returns its record with capabilities.
|
||||||
|
ResolveOrigin(context.Context, *QueryResolveOriginRequest) (*QueryResolveOriginResponse, error)
|
||||||
mustEmbedUnimplementedQueryServer()
|
mustEmbedUnimplementedQueryServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +101,12 @@ type UnimplementedQueryServer struct{}
|
|||||||
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedQueryServer) OriginExists(context.Context, *QueryOriginExistsRequest) (*QueryOriginExistsResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method OriginExists not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedQueryServer) ResolveOrigin(context.Context, *QueryResolveOriginRequest) (*QueryResolveOriginResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ResolveOrigin not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||||
func (UnimplementedQueryServer) testEmbeddedByValue() {}
|
func (UnimplementedQueryServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@@ -110,6 +146,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Query_OriginExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryOriginExistsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QueryServer).OriginExists(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Query_OriginExists_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QueryServer).OriginExists(ctx, req.(*QueryOriginExistsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Query_ResolveOrigin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryResolveOriginRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QueryServer).ResolveOrigin(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Query_ResolveOrigin_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QueryServer).ResolveOrigin(ctx, req.(*QueryResolveOriginRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -121,6 +193,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "Params",
|
MethodName: "Params",
|
||||||
Handler: _Query_Params_Handler,
|
Handler: _Query_Params_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "OriginExists",
|
||||||
|
Handler: _Query_OriginExists_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ResolveOrigin",
|
||||||
|
Handler: _Query_ResolveOrigin_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "svc/v1/query.proto",
|
Metadata: "svc/v1/query.proto",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
# Local Interchain Configurations
|
|
||||||
|
|
||||||
RUN:
|
|
||||||
- `make testnet` *(full setup: docker image, binary, keys, and ibc testnet start)*
|
|
||||||
- `spawn local-ic start testnet` *(Standalone start)*
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
* https://github.com/strangelove-ventures/interchaintest/tree/main/local-interchain
|
|
||||||
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
{
|
|
||||||
"chains": [
|
|
||||||
{
|
|
||||||
"name": "core",
|
|
||||||
"ibc_paths": ["ibc-connection-1"],
|
|
||||||
"chain_id": "chainid-1",
|
|
||||||
"denom": "usnr",
|
|
||||||
"binary": "sonrd",
|
|
||||||
"bech32_prefix": "idx",
|
|
||||||
"docker_image": {
|
|
||||||
"repository": "core",
|
|
||||||
"version": "local"
|
|
||||||
},
|
|
||||||
"gas_prices": "0usnr",
|
|
||||||
"chain_type": "cosmos",
|
|
||||||
"coin_type": 118,
|
|
||||||
"trusting_period": "336h",
|
|
||||||
"gas_adjustment": 1.5,
|
|
||||||
"number_vals": 1,
|
|
||||||
"number_node": 0,
|
|
||||||
"debugging": true,
|
|
||||||
"block_time": "1000ms",
|
|
||||||
"host_port_override": {
|
|
||||||
"26657": "26657",
|
|
||||||
"1317": "1317",
|
|
||||||
"9090": "9090"
|
|
||||||
},
|
|
||||||
"encoding-options": ["wasm", "tokenfactory"],
|
|
||||||
"config_file_overrides": [
|
|
||||||
{
|
|
||||||
"file": "config/config.toml",
|
|
||||||
"paths": {
|
|
||||||
"moniker": "localvalmoniker",
|
|
||||||
"rpc.cors_allowed_origins": ["*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"genesis": {
|
|
||||||
"modify": [
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.voting_period",
|
|
||||||
"value": "15s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.expedited_voting_period",
|
|
||||||
"value": "10s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.max_deposit_period",
|
|
||||||
"value": "15s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.min_deposit.0.denom",
|
|
||||||
"value": "usnr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.min_deposit.0.amount",
|
|
||||||
"value": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"name": "acc0",
|
|
||||||
"address": "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd",
|
|
||||||
"amount": "10000000000usnr",
|
|
||||||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc1",
|
|
||||||
"address": "idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y",
|
|
||||||
"amount": "10000000000usnr",
|
|
||||||
"mnemonic": "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"startup_commands": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gaia",
|
|
||||||
"chain_id": "localcosmos-1",
|
|
||||||
"denom": "uatom",
|
|
||||||
"binary": "gaiad",
|
|
||||||
"bech32_prefix": "cosmos",
|
|
||||||
"docker_image": {
|
|
||||||
"version": "v9.1.0"
|
|
||||||
},
|
|
||||||
"block_time": "1000ms",
|
|
||||||
"gas_prices": "0%DENOM%",
|
|
||||||
"gas_adjustment": 2.0,
|
|
||||||
"ibc_paths": ["ibc-connection-1"],
|
|
||||||
"genesis": {
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"name": "acc0",
|
|
||||||
"address": "cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr",
|
|
||||||
"amount": "10000000%DENOM%",
|
|
||||||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
{
|
|
||||||
"chains": [
|
|
||||||
{
|
|
||||||
"name": "core",
|
|
||||||
"chain_id": "chainid-1",
|
|
||||||
"denom": "usnr",
|
|
||||||
"binary": "sonrd",
|
|
||||||
"bech32_prefix": "idx",
|
|
||||||
"docker_image": {
|
|
||||||
"repository": "core",
|
|
||||||
"version": "local"
|
|
||||||
},
|
|
||||||
"gas_prices": "0usnr",
|
|
||||||
"chain_type": "cosmos",
|
|
||||||
"coin_type": 118,
|
|
||||||
"trusting_period": "336h",
|
|
||||||
"gas_adjustment": 1.5,
|
|
||||||
"number_vals": 1,
|
|
||||||
"number_node": 0,
|
|
||||||
"debugging": true,
|
|
||||||
"block_time": "1000ms",
|
|
||||||
"host_port_override": {
|
|
||||||
"26657": "26657",
|
|
||||||
"1317": "1317",
|
|
||||||
"9090": "9090"
|
|
||||||
},
|
|
||||||
"encoding-options": ["wasm", "tokenfactory"],
|
|
||||||
"config_file_overrides": [
|
|
||||||
{
|
|
||||||
"file": "config/config.toml",
|
|
||||||
"paths": {
|
|
||||||
"moniker": "localvalmoniker",
|
|
||||||
"rpc.cors_allowed_origins": ["*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"genesis": {
|
|
||||||
"modify": [
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.voting_period",
|
|
||||||
"value": "15s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.expedited_voting_period",
|
|
||||||
"value": "10s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.max_deposit_period",
|
|
||||||
"value": "15s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.min_deposit.0.denom",
|
|
||||||
"value": "usnr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "app_state.gov.params.min_deposit.0.amount",
|
|
||||||
"value": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"name": "acc0",
|
|
||||||
"address": "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd",
|
|
||||||
"amount": "10000000000usnr",
|
|
||||||
"mnemonic": "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc1",
|
|
||||||
"address": "idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y",
|
|
||||||
"amount": "10000000000usnr",
|
|
||||||
"mnemonic": "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"startup_commands": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/common"
|
|
||||||
"github.com/onsonr/sonr/pkg/gateway"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Command line flags
|
|
||||||
var (
|
|
||||||
servePort int // Gateway http entry point (default 3000)
|
|
||||||
chainID string // Current chain ID (default sonr-testnet-1)
|
|
||||||
ipfsGatewayURL string // IPFS gateway URL (default localhost:8080)
|
|
||||||
sonrAPIURL string // Sonr API URL (default localhost:1317)
|
|
||||||
sonrGrpcURL string // Sonr gRPC URL (default localhost:9090)
|
|
||||||
sonrRPCURL string // Sonr RPC URL (default localhost:26657)
|
|
||||||
|
|
||||||
psqlHost string // PostgresSQL Host Flag
|
|
||||||
psqlUser string // PostgresSQL User Flag
|
|
||||||
psqlPass string // PostgresSQL Password Flag
|
|
||||||
psqlDB string // PostgresSQL Database Flag
|
|
||||||
)
|
|
||||||
|
|
||||||
func rootCmd() *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
|
||||||
Use: "hway",
|
|
||||||
Short: "Sonr DID gateway",
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
|
||||||
env, err := loadEnvImplFromArgs(args)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
ipc, err := common.NewIPFS()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
e, err := gateway.New(env, ipc)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if err := e.Start(fmt.Sprintf(":%d", env.GetServePort())); err != http.ErrServerClosed {
|
|
||||||
log.Fatal(err)
|
|
||||||
os.Exit(1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
cmd.Flags().IntVar(&servePort, "serve-port", 3000, "Port to serve the gateway on")
|
|
||||||
cmd.Flags().StringVar(&chainID, "chain-id", "sonr-testnet-1", "Chain ID")
|
|
||||||
cmd.Flags().StringVar(&ipfsGatewayURL, "ipfs-gateway-url", "localhost:8080", "IPFS gateway URL")
|
|
||||||
cmd.Flags().StringVar(&sonrAPIURL, "sonr-api-url", "localhost:1317", "Sonr API URL")
|
|
||||||
cmd.Flags().StringVar(&sonrGrpcURL, "sonr-grpc-url", "localhost:9090", "Sonr gRPC URL")
|
|
||||||
cmd.Flags().StringVar(&sonrRPCURL, "sonr-rpc-url", "localhost:26657", "Sonr RPC URL")
|
|
||||||
cmd.Flags().StringVar(&psqlHost, "psql-host", "", "PostgresSQL Host")
|
|
||||||
cmd.Flags().StringVar(&psqlUser, "psql-user", "", "PostgresSQL User")
|
|
||||||
cmd.Flags().StringVar(&psqlPass, "psql-pass", "", "PostgresSQL Password")
|
|
||||||
cmd.Flags().StringVar(&psqlDB, "psql-db", "", "PostgresSQL Database")
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatPsqlDSN() string {
|
|
||||||
if psqlHost == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("host=%s user=%s password=%s dbname=%s sslmode=disable", psqlHost, psqlUser, psqlPass, psqlDB)
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "embed"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
config "github.com/onsonr/sonr/internal/config/hway"
|
|
||||||
)
|
|
||||||
|
|
||||||
// main is the entry point for the application
|
|
||||||
func main() {
|
|
||||||
cmd := rootCmd()
|
|
||||||
if err := cmd.Execute(); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadEnvImplFromArgs(args []string) (config.Hway, error) {
|
|
||||||
cmd := rootCmd()
|
|
||||||
if err := cmd.ParseFlags(args); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
env := &config.HwayImpl{
|
|
||||||
ServePort: servePort,
|
|
||||||
ChainId: chainID,
|
|
||||||
IpfsGatewayUrl: ipfsGatewayURL,
|
|
||||||
SonrApiUrl: sonrAPIURL,
|
|
||||||
SonrGrpcUrl: sonrGrpcURL,
|
|
||||||
SonrRpcUrl: sonrRPCURL,
|
|
||||||
PsqlDSN: formatPsqlDSN(),
|
|
||||||
}
|
|
||||||
return env, nil
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
//go:build js && wasm
|
|
||||||
// +build js,wasm
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"syscall/js"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
|
||||||
"github.com/onsonr/sonr/pkg/vault/routes"
|
|
||||||
"github.com/onsonr/sonr/cmd/motr/wasm"
|
|
||||||
"github.com/onsonr/sonr/internal/config/motr"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
env *motr.Environment
|
|
||||||
config *motr.Config
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
func broadcastTx(this js.Value, args []js.Value) interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func simulateTx(this js.Value, args []js.Value) interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func syncData(this js.Value, args []js.Value) interface{} {
|
|
||||||
if len(args) < 1 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
configString := args[0].String()
|
|
||||||
if err := json.Unmarshal([]byte(configString), &config); err != nil {
|
|
||||||
println("Error parsing config:", err.Error())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Load dwn config
|
|
||||||
js.Global().Set("broadcastTx", js.FuncOf(broadcastTx))
|
|
||||||
js.Global().Set("simulateTx", js.FuncOf(simulateTx))
|
|
||||||
js.Global().Set("syncData", js.FuncOf(syncData))
|
|
||||||
|
|
||||||
e := echo.New()
|
|
||||||
e.Use(wasm.ContextMiddleware)
|
|
||||||
// e.Use(controller.Middleware(nil))
|
|
||||||
vault.RegisterRoutes(e, config)
|
|
||||||
wasm.ServeFetch(e)
|
|
||||||
}
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
//go:build js && wasm
|
|
||||||
// +build js,wasm
|
|
||||||
|
|
||||||
package wasm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httptest"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"syscall/js"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// Global buffer pool to reduce allocations
|
|
||||||
bufferPool = sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
return new(bytes.Buffer)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached JS globals
|
|
||||||
jsGlobal = js.Global()
|
|
||||||
jsUint8Array = jsGlobal.Get("Uint8Array")
|
|
||||||
jsResponse = jsGlobal.Get("Response")
|
|
||||||
jsPromise = jsGlobal.Get("Promise")
|
|
||||||
jsWasmHTTP = jsGlobal.Get("wasmhttp")
|
|
||||||
)
|
|
||||||
|
|
||||||
// ServeFetch serves HTTP requests with optimized handler management
|
|
||||||
func ServeFetch(handler http.Handler) func() {
|
|
||||||
h := handler
|
|
||||||
if h == nil {
|
|
||||||
h = http.DefaultServeMux
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optimize prefix handling
|
|
||||||
prefix := strings.TrimRight(jsWasmHTTP.Get("path").String(), "/")
|
|
||||||
if prefix != "" {
|
|
||||||
mux := http.NewServeMux()
|
|
||||||
mux.Handle(prefix+"/", http.StripPrefix(prefix, h))
|
|
||||||
h = mux
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create request handler function
|
|
||||||
cb := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
promise, resolve, reject := newPromiseOptimized()
|
|
||||||
|
|
||||||
go handleRequest(h, args[1], resolve, reject)
|
|
||||||
|
|
||||||
return promise
|
|
||||||
})
|
|
||||||
|
|
||||||
jsWasmHTTP.Call("setHandler", cb)
|
|
||||||
return cb.Release
|
|
||||||
}
|
|
||||||
|
|
||||||
// handleRequest processes the request with panic recovery
|
|
||||||
func handleRequest(h http.Handler, jsReq js.Value, resolve, reject func(interface{})) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
var errMsg string
|
|
||||||
if err, ok := r.(error); ok {
|
|
||||||
errMsg = fmt.Sprintf("wasmhttp: panic: %+v", err)
|
|
||||||
} else {
|
|
||||||
errMsg = fmt.Sprintf("wasmhttp: panic: %v", r)
|
|
||||||
}
|
|
||||||
reject(errMsg)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
recorder := newResponseRecorder()
|
|
||||||
h.ServeHTTP(recorder, buildRequest(jsReq))
|
|
||||||
resolve(recorder.jsResponse())
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildRequest creates an http.Request from JS Request
|
|
||||||
func buildRequest(jsReq js.Value) *http.Request {
|
|
||||||
// Get request body
|
|
||||||
arrayBuffer, err := awaitPromiseOptimized(jsReq.Call("arrayBuffer"))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create body buffer
|
|
||||||
jsBody := jsUint8Array.New(arrayBuffer)
|
|
||||||
bodyLen := jsBody.Get("length").Int()
|
|
||||||
body := make([]byte, bodyLen)
|
|
||||||
js.CopyBytesToGo(body, jsBody)
|
|
||||||
|
|
||||||
// Create request
|
|
||||||
req := httptest.NewRequest(
|
|
||||||
jsReq.Get("method").String(),
|
|
||||||
jsReq.Get("url").String(),
|
|
||||||
bytes.NewReader(body),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Set headers efficiently
|
|
||||||
headers := jsReq.Get("headers")
|
|
||||||
headersIt := headers.Call("entries")
|
|
||||||
for {
|
|
||||||
entry := headersIt.Call("next")
|
|
||||||
if entry.Get("done").Bool() {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
pair := entry.Get("value")
|
|
||||||
req.Header.Set(pair.Index(0).String(), pair.Index(1).String())
|
|
||||||
}
|
|
||||||
|
|
||||||
return req
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResponseRecorder with optimized buffer handling
|
|
||||||
type ResponseRecorder struct {
|
|
||||||
*httptest.ResponseRecorder
|
|
||||||
buffer *bytes.Buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
func newResponseRecorder() *ResponseRecorder {
|
|
||||||
return &ResponseRecorder{
|
|
||||||
ResponseRecorder: httptest.NewRecorder(),
|
|
||||||
buffer: bufferPool.Get().(*bytes.Buffer),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// jsResponse creates a JS Response with optimized memory usage
|
|
||||||
func (rr *ResponseRecorder) jsResponse() js.Value {
|
|
||||||
defer func() {
|
|
||||||
rr.buffer.Reset()
|
|
||||||
bufferPool.Put(rr.buffer)
|
|
||||||
}()
|
|
||||||
|
|
||||||
res := rr.Result()
|
|
||||||
defer res.Body.Close()
|
|
||||||
|
|
||||||
// Prepare response body
|
|
||||||
body := js.Undefined()
|
|
||||||
if res.ContentLength != 0 {
|
|
||||||
if _, err := io.Copy(rr.buffer, res.Body); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
bodyBytes := rr.buffer.Bytes()
|
|
||||||
body = jsUint8Array.New(len(bodyBytes))
|
|
||||||
js.CopyBytesToJS(body, bodyBytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare response init object
|
|
||||||
init := make(map[string]interface{}, 3)
|
|
||||||
if res.StatusCode != 0 {
|
|
||||||
init["status"] = res.StatusCode
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res.Header) > 0 {
|
|
||||||
headers := make(map[string]interface{}, len(res.Header))
|
|
||||||
for k, v := range res.Header {
|
|
||||||
if len(v) > 0 {
|
|
||||||
headers[k] = v[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
init["headers"] = headers
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsResponse.New(body, init)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newPromiseOptimized creates a new JavaScript Promise with optimized callback handling
|
|
||||||
func newPromiseOptimized() (js.Value, func(interface{}), func(interface{})) {
|
|
||||||
var (
|
|
||||||
resolve func(interface{})
|
|
||||||
reject func(interface{})
|
|
||||||
promiseFunc = js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
resolve = func(v interface{}) { args[0].Invoke(v) }
|
|
||||||
reject = func(v interface{}) { args[1].Invoke(v) }
|
|
||||||
return js.Undefined()
|
|
||||||
})
|
|
||||||
)
|
|
||||||
defer promiseFunc.Release()
|
|
||||||
|
|
||||||
return jsPromise.New(promiseFunc), resolve, reject
|
|
||||||
}
|
|
||||||
|
|
||||||
// awaitPromiseOptimized waits for Promise resolution with optimized channel handling
|
|
||||||
func awaitPromiseOptimized(promise js.Value) (js.Value, error) {
|
|
||||||
done := make(chan struct{})
|
|
||||||
var (
|
|
||||||
result js.Value
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
thenFunc := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
result = args[0]
|
|
||||||
close(done)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
defer thenFunc.Release()
|
|
||||||
|
|
||||||
catchFunc := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
err = js.Error{Value: args[0]}
|
|
||||||
close(done)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
defer catchFunc.Release()
|
|
||||||
|
|
||||||
promise.Call("then", thenFunc).Call("catch", catchFunc)
|
|
||||||
<-done
|
|
||||||
|
|
||||||
return result, err
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
//go:build js && wasm
|
|
||||||
// +build js,wasm
|
|
||||||
|
|
||||||
package wasm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ContextMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
|
||||||
return func(c echo.Context) error {
|
|
||||||
// Extract WASM context from headers
|
|
||||||
if wasmCtx := c.Request().Header.Get("X-Wasm-Context"); wasmCtx != "" {
|
|
||||||
if ctx, err := DecodeWasmContext(wasmCtx); err == nil {
|
|
||||||
c.Set("wasm_context", ctx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return next(c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// decodeWasmContext decodes the WASM context from a base64 encoded string
|
|
||||||
func DecodeWasmContext(ctx string) (map[string]any, error) {
|
|
||||||
decoded, err := base64.StdEncoding.DecodeString(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
var ctxData map[string]any
|
|
||||||
err = json.Unmarshal(decoded, &ctxData)
|
|
||||||
return ctxData, err
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rootCmd := NewRootCmd()
|
rootCmd := NewRootCmd()
|
||||||
rootCmd.AddCommand(newPklInitCmd())
|
|
||||||
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
|
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
|
||||||
log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err)
|
log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/apple/pkl-go/pkl"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var configDir string
|
|
||||||
|
|
||||||
func newPklInitCmd() *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
|
||||||
Use: "init-pkl",
|
|
||||||
Short: "Initialize the Sonrd configuration using PKL",
|
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
|
||||||
ctx := context.Background()
|
|
||||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer evaluator.Close()
|
|
||||||
|
|
||||||
appPath := formatConfigPath(cmd, "app.toml")
|
|
||||||
configPath := formatConfigPath(cmd, "config.toml")
|
|
||||||
|
|
||||||
// Create app.toml
|
|
||||||
if err := createAppToml(evaluator, appPath); err != nil {
|
|
||||||
cmd.PrintErrf("Failed to create app.toml: %v\n", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
cmd.Printf("Successfully created %s\n", appPath)
|
|
||||||
|
|
||||||
// Create config.toml
|
|
||||||
if err := createConfigToml(evaluator, configPath); err != nil {
|
|
||||||
cmd.PrintErrf("Failed to create config.toml: %v\n", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
cmd.Printf("Successfully created %s\n", configPath)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
|
||||||
cmd.Flags().StringVar(&configDir, "config-dir", "~/.sonr/config", "Path to where pkl files should be output")
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
func createAppToml(evaluator pkl.Evaluator, path string) error {
|
|
||||||
appSource := pkl.UriSource("https://pkl.sh/sonr.chain/0.0.2/App.pkl")
|
|
||||||
res, err := evaluator.EvaluateOutputText(context.Background(), appSource)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
log.Printf("res: %s", res)
|
|
||||||
return writeConfigFile(path, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func createConfigToml(evaluator pkl.Evaluator, path string) error {
|
|
||||||
configSource := pkl.UriSource("https://pkl.sh/sonr.chain/0.0.2/Config.pkl")
|
|
||||||
res, err := evaluator.EvaluateOutputText(context.Background(), configSource)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
log.Printf("res: %s", res)
|
|
||||||
return writeConfigFile(path, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatConfigPath(cmd *cobra.Command, fileName string) string {
|
|
||||||
configDir := cmd.Flag("config-dir").Value.String()
|
|
||||||
// Expand home directory if needed
|
|
||||||
if configDir[:2] == "~/" {
|
|
||||||
home, err := os.UserHomeDir()
|
|
||||||
if err == nil {
|
|
||||||
configDir = filepath.Join(home, configDir[2:])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filepath.Join(configDir, fileName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeConfigFile(path string, content string) error {
|
|
||||||
// Create the directory path if it doesn't exist
|
|
||||||
dir := filepath.Dir(path)
|
|
||||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if file already exists
|
|
||||||
if _, err := os.Stat(path); err == nil {
|
|
||||||
// File exists, create backup
|
|
||||||
backupPath := path + ".backup"
|
|
||||||
if err := os.Rename(path, backupPath); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the new config file
|
|
||||||
return os.WriteFile(path, []byte(content), 0o644)
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
###
|
|
||||||
# Find OS and Go environment
|
|
||||||
# GO contains the Go binary
|
|
||||||
# FS contains the OS file separator
|
|
||||||
###
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
GO := $(shell where go.exe 2> NUL)
|
|
||||||
FS := "\\"
|
|
||||||
else
|
|
||||||
GO := $(shell command -v go 2> /dev/null)
|
|
||||||
FS := "/"
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(GO),)
|
|
||||||
$(error could not find go. Is it in PATH? $(GO))
|
|
||||||
endif
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Functions ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
go_get = $(if $(findstring Windows_NT,$(OS)),\
|
|
||||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\
|
|
||||||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\
|
|
||||||
,\
|
|
||||||
mkdir -p $(GITHUBDIR)$(FS)$(1) &&\
|
|
||||||
(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\
|
|
||||||
)\
|
|
||||||
cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
|
|
||||||
|
|
||||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
||||||
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Tools ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
BIN ?= $(PREFIX)/bin
|
|
||||||
UNAME_S ?= $(shell uname -s)
|
|
||||||
UNAME_M ?= $(shell uname -m)
|
|
||||||
|
|
||||||
GOPATH ?= $(shell $(GO) env GOPATH)
|
|
||||||
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
|
|
||||||
|
|
||||||
BUF_VERSION ?= 0.11.0
|
|
||||||
|
|
||||||
TOOLS_DESTDIR ?= $(GOPATH)/bin
|
|
||||||
STATIK = $(TOOLS_DESTDIR)/statik
|
|
||||||
RUNSIM = $(TOOLS_DESTDIR)/runsim
|
|
||||||
GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint
|
|
||||||
|
|
||||||
tools: tools-stamp
|
|
||||||
tools-stamp: statik runsim golangci-lint
|
|
||||||
# Create dummy file to satisfy dependency and avoid
|
|
||||||
# rebuilding when this Makefile target is hit twice
|
|
||||||
# in a row.
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
statik: $(STATIK)
|
|
||||||
$(STATIK):
|
|
||||||
@echo "Installing statik..."
|
|
||||||
@(cd /tmp && go install github.com/rakyll/statik@v0.1.6)
|
|
||||||
|
|
||||||
# Install the runsim binary with a temporary workaround of entering an outside
|
|
||||||
# directory as the "go get" command ignores the -mod option and will polute the
|
|
||||||
# go.{mod, sum} files.
|
|
||||||
#
|
|
||||||
# ref: https://github.com/golang/go/issues/30515
|
|
||||||
runsim: $(RUNSIM)
|
|
||||||
$(RUNSIM):
|
|
||||||
@echo "Installing runsim..."
|
|
||||||
@(cd /tmp && go install github.com/cosmos/tools/cmd/runsim@v1.0.0)
|
|
||||||
|
|
||||||
golangci-lint: $(GOLANGCI_LINT)
|
|
||||||
$(GOLANGCI_LINT):
|
|
||||||
@echo "Installing golangci-lint..."
|
|
||||||
@(cd /tmp && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.0)
|
|
||||||
|
|
||||||
tools-clean:
|
|
||||||
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM)
|
|
||||||
rm -f tools-stamp
|
|
||||||
|
|
||||||
.PHONY: tools-clean statik runsim
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
## Contributors
|
|
||||||
|
|
||||||
Thanks to the entire Cosmos SDK team and the contributors who put their efforts into making simulation testing
|
|
||||||
easier to implement. 🤗
|
|
||||||
|
|
||||||
https://github.com/cosmos/cosmos-sdk/blob/master/contrib/devtools/Makefile
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package attns
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/apple/pkl-go/pkl"
|
|
||||||
)
|
|
||||||
|
|
||||||
type UCAN struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a UCAN
|
|
||||||
func LoadFromPath(ctx context.Context, path string) (ret *UCAN, err error) {
|
|
||||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
cerr := evaluator.Close()
|
|
||||||
if err == nil {
|
|
||||||
err = cerr
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a UCAN
|
|
||||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*UCAN, error) {
|
|
||||||
var ret UCAN
|
|
||||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &ret, nil
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package capaccount
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CapAccount string
|
|
||||||
|
|
||||||
const (
|
|
||||||
ExecBroadcast CapAccount = "exec/broadcast"
|
|
||||||
ExecQuery CapAccount = "exec/query"
|
|
||||||
ExecSimulate CapAccount = "exec/simulate"
|
|
||||||
ExecVote CapAccount = "exec/vote"
|
|
||||||
ExecDelegate CapAccount = "exec/delegate"
|
|
||||||
ExecInvoke CapAccount = "exec/invoke"
|
|
||||||
ExecSend CapAccount = "exec/send"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of CapAccount
|
|
||||||
func (rcv CapAccount) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(CapAccount)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for CapAccount.
|
|
||||||
func (rcv *CapAccount) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "exec/broadcast":
|
|
||||||
*rcv = ExecBroadcast
|
|
||||||
case "exec/query":
|
|
||||||
*rcv = ExecQuery
|
|
||||||
case "exec/simulate":
|
|
||||||
*rcv = ExecSimulate
|
|
||||||
case "exec/vote":
|
|
||||||
*rcv = ExecVote
|
|
||||||
case "exec/delegate":
|
|
||||||
*rcv = ExecDelegate
|
|
||||||
case "exec/invoke":
|
|
||||||
*rcv = ExecInvoke
|
|
||||||
case "exec/send":
|
|
||||||
*rcv = ExecSend
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid CapAccount`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package capaccount
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func NewCap(ty CapAccount) ucan.Capability {
|
|
||||||
return ucan.Capability(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c CapAccount) Contains(b ucan.Capability) bool {
|
|
||||||
return c.String() == b.String()
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package capinterchain
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CapInterchain string
|
|
||||||
|
|
||||||
const (
|
|
||||||
TransferSwap CapInterchain = "transfer/swap"
|
|
||||||
TransferSend CapInterchain = "transfer/send"
|
|
||||||
TransferAtomic CapInterchain = "transfer/atomic"
|
|
||||||
TransferBatch CapInterchain = "transfer/batch"
|
|
||||||
TransferP2p CapInterchain = "transfer/p2p"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of CapInterchain
|
|
||||||
func (rcv CapInterchain) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(CapInterchain)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for CapInterchain.
|
|
||||||
func (rcv *CapInterchain) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "transfer/swap":
|
|
||||||
*rcv = TransferSwap
|
|
||||||
case "transfer/send":
|
|
||||||
*rcv = TransferSend
|
|
||||||
case "transfer/atomic":
|
|
||||||
*rcv = TransferAtomic
|
|
||||||
case "transfer/batch":
|
|
||||||
*rcv = TransferBatch
|
|
||||||
case "transfer/p2p":
|
|
||||||
*rcv = TransferP2p
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid CapInterchain`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package capinterchain
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func NewCap(ty CapInterchain) ucan.Capability {
|
|
||||||
return ucan.Capability(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c CapInterchain) Contains(b ucan.Capability) bool {
|
|
||||||
return c.String() == b.String()
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package capvault
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CapVault string
|
|
||||||
|
|
||||||
const (
|
|
||||||
CrudAsset CapVault = "crud/asset"
|
|
||||||
CrudAuthzgrant CapVault = "crud/authzgrant"
|
|
||||||
CrudProfile CapVault = "crud/profile"
|
|
||||||
CrudRecord CapVault = "crud/record"
|
|
||||||
UseRecovery CapVault = "use/recovery"
|
|
||||||
UseSync CapVault = "use/sync"
|
|
||||||
UseSigner CapVault = "use/signer"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of CapVault
|
|
||||||
func (rcv CapVault) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(CapVault)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for CapVault.
|
|
||||||
func (rcv *CapVault) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "crud/asset":
|
|
||||||
*rcv = CrudAsset
|
|
||||||
case "crud/authzgrant":
|
|
||||||
*rcv = CrudAuthzgrant
|
|
||||||
case "crud/profile":
|
|
||||||
*rcv = CrudProfile
|
|
||||||
case "crud/record":
|
|
||||||
*rcv = CrudRecord
|
|
||||||
case "use/recovery":
|
|
||||||
*rcv = UseRecovery
|
|
||||||
case "use/sync":
|
|
||||||
*rcv = UseSync
|
|
||||||
case "use/signer":
|
|
||||||
*rcv = UseSigner
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid CapVault`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package capvault
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func NewCap(ty CapVault) ucan.Capability {
|
|
||||||
return ucan.Capability(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c CapVault) Contains(b ucan.Capability) bool {
|
|
||||||
return c.String() == b.String()
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
// Package attns implements the UCAN resource and capability types
|
|
||||||
package attns
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/capaccount"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/capinterchain"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/capvault"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/resaccount"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/resinterchain"
|
|
||||||
"github.com/onsonr/sonr/crypto/ucan/attns/resvault"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Capability hierarchy for sonr network
|
|
||||||
// -------------------------------------
|
|
||||||
// VAULT (DWN)
|
|
||||||
//
|
|
||||||
// └─ CRUD/ASSET
|
|
||||||
// └─ CRUD/AUTHZGRANT
|
|
||||||
// └─ CRUD/PROFILE
|
|
||||||
// └─ CRUD/RECORD
|
|
||||||
// └─ USE/RECOVERY
|
|
||||||
// └─ USE/SYNC
|
|
||||||
// └─ USE/SIGNER
|
|
||||||
//
|
|
||||||
// ACCOUNT (DID)
|
|
||||||
//
|
|
||||||
// └─ EXEC/BROADCAST
|
|
||||||
// └─ EXEC/QUERY
|
|
||||||
// └─ EXEC/SIMULATE
|
|
||||||
// └─ EXEC/VOTE
|
|
||||||
// └─ EXEC/DELEGATE
|
|
||||||
// └─ EXEC/INVOKE
|
|
||||||
// └─ EXEC/SEND
|
|
||||||
//
|
|
||||||
// INTERCHAIN
|
|
||||||
//
|
|
||||||
// └─ TRANSFER/SWAP
|
|
||||||
// └─ TRANSFER/SEND
|
|
||||||
// └─ TRANSFER/ATOMIC
|
|
||||||
// └─ TRANSFER/BATCH
|
|
||||||
// └─ TRANSFER/P2P
|
|
||||||
// └─ TRANSFER/SEND
|
|
||||||
|
|
||||||
type Capability string
|
|
||||||
|
|
||||||
const (
|
|
||||||
CapExecBroadcast = capaccount.ExecBroadcast
|
|
||||||
CapExecQuery = capaccount.ExecQuery
|
|
||||||
CapExecSimulate = capaccount.ExecSimulate
|
|
||||||
CapExecVote = capaccount.ExecVote
|
|
||||||
CapExecDelegate = capaccount.ExecDelegate
|
|
||||||
CapExecInvoke = capaccount.ExecInvoke
|
|
||||||
CapExecSend = capaccount.ExecSend
|
|
||||||
|
|
||||||
CapTransferSwap = capinterchain.TransferSwap
|
|
||||||
CapTransferSend = capinterchain.TransferSend
|
|
||||||
CapTransferAtomic = capinterchain.TransferAtomic
|
|
||||||
CapTransferBatch = capinterchain.TransferBatch
|
|
||||||
CapTransferP2P = capinterchain.TransferP2p
|
|
||||||
|
|
||||||
CapCrudAsset = capvault.CrudAsset
|
|
||||||
CapCrudAuthzgrant = capvault.CrudAuthzgrant
|
|
||||||
CapCrudProfile = capvault.CrudProfile
|
|
||||||
CapCrudRecord = capvault.CrudRecord
|
|
||||||
CapUseRecovery = capvault.UseRecovery
|
|
||||||
CapUseSync = capvault.UseSync
|
|
||||||
CapUseSigner = capvault.UseSigner
|
|
||||||
)
|
|
||||||
|
|
||||||
type NewCapFunc func(string) ucan.Capability
|
|
||||||
|
|
||||||
type BuildResourceFunc func(string, string) ucan.Resource
|
|
||||||
|
|
||||||
func CreateArray(attns ...ucan.Attenuation) ucan.Attenuations {
|
|
||||||
return ucan.Attenuations(attns)
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(cap ucan.Capability, rsc ucan.Resource) ucan.Attenuation {
|
|
||||||
return ucan.Attenuation{
|
|
||||||
Cap: cap,
|
|
||||||
Rsc: rsc,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewAccountCap creates a new account capability
|
|
||||||
func NewAccountCap(ty capaccount.CapAccount) ucan.Capability {
|
|
||||||
return capaccount.NewCap(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewInterchainCap creates a new interchain capability
|
|
||||||
func NewInterchainCap(ty capinterchain.CapInterchain) ucan.Capability {
|
|
||||||
return capinterchain.NewCap(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVaultCap creates a new vault capability
|
|
||||||
func NewVaultCap(ty capvault.CapVault) ucan.Capability {
|
|
||||||
return capvault.NewCap(ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BuildAccountResource creates a new account resource
|
|
||||||
func BuildAccountResource(ty resaccount.ResAccount, value string) ucan.Resource {
|
|
||||||
return resaccount.Build(ty, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BuildInterchainResource creates a new interchain resource
|
|
||||||
func BuildInterchainResource(ty resinterchain.ResInterchain, value string) ucan.Resource {
|
|
||||||
return resinterchain.Build(ty, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BuildVaultResource creates a new vault resource
|
|
||||||
func BuildVaultResource(ty resvault.ResVault, value string) ucan.Resource {
|
|
||||||
return resvault.Build(ty, value)
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package attns
|
|
||||||
|
|
||||||
import "github.com/apple/pkl-go/pkl"
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
pkl.RegisterMapping("sonr.orm.UCAN", UCAN{})
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package resaccount
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ResAccount string
|
|
||||||
|
|
||||||
const (
|
|
||||||
AccSequence ResAccount = "acc/sequence"
|
|
||||||
AccNumber ResAccount = "acc/number"
|
|
||||||
ChainId ResAccount = "chain/id"
|
|
||||||
AssetCode ResAccount = "asset/code"
|
|
||||||
AuthzGrant ResAccount = "authz/grant"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of ResAccount
|
|
||||||
func (rcv ResAccount) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(ResAccount)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for ResAccount.
|
|
||||||
func (rcv *ResAccount) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "acc/sequence":
|
|
||||||
*rcv = AccSequence
|
|
||||||
case "acc/number":
|
|
||||||
*rcv = AccNumber
|
|
||||||
case "chain/id":
|
|
||||||
*rcv = ChainId
|
|
||||||
case "asset/code":
|
|
||||||
*rcv = AssetCode
|
|
||||||
case "authz/grant":
|
|
||||||
*rcv = AuthzGrant
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid ResAccount`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package resaccount
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func Build(ty ResAccount, value string) ucan.Resource {
|
|
||||||
return newStringLengthResource(ty.String(), value)
|
|
||||||
}
|
|
||||||
|
|
||||||
type stringLengthRsc struct {
|
|
||||||
t string
|
|
||||||
v string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewStringLengthResource is a silly implementation of resource to use while
|
|
||||||
// I figure out what an OR filter on strings is. Don't use this.
|
|
||||||
func newStringLengthResource(typ, val string) ucan.Resource {
|
|
||||||
return stringLengthRsc{
|
|
||||||
t: typ,
|
|
||||||
v: val,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Type() string {
|
|
||||||
return r.t
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Value() string {
|
|
||||||
return r.v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Contains(b ucan.Resource) bool {
|
|
||||||
return r.Type() == b.Type() && len(r.Value()) <= len(b.Value())
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package resinterchain
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ResInterchain string
|
|
||||||
|
|
||||||
const (
|
|
||||||
ChannnelPort ResInterchain = "channnel/port"
|
|
||||||
ChainId ResInterchain = "chain/id"
|
|
||||||
ChainName ResInterchain = "chain/name"
|
|
||||||
AccHost ResInterchain = "acc/host"
|
|
||||||
AccController ResInterchain = "acc/controller"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of ResInterchain
|
|
||||||
func (rcv ResInterchain) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(ResInterchain)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for ResInterchain.
|
|
||||||
func (rcv *ResInterchain) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "channnel/port":
|
|
||||||
*rcv = ChannnelPort
|
|
||||||
case "chain/id":
|
|
||||||
*rcv = ChainId
|
|
||||||
case "chain/name":
|
|
||||||
*rcv = ChainName
|
|
||||||
case "acc/host":
|
|
||||||
*rcv = AccHost
|
|
||||||
case "acc/controller":
|
|
||||||
*rcv = AccController
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid ResInterchain`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package resinterchain
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func Build(ty ResInterchain, value string) ucan.Resource {
|
|
||||||
return newStringLengthResource(ty.String(), value)
|
|
||||||
}
|
|
||||||
|
|
||||||
type stringLengthRsc struct {
|
|
||||||
t string
|
|
||||||
v string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewStringLengthResource is a silly implementation of resource to use while
|
|
||||||
// I figure out what an OR filter on strings is. Don't use this.
|
|
||||||
func newStringLengthResource(typ, val string) ucan.Resource {
|
|
||||||
return stringLengthRsc{
|
|
||||||
t: typ,
|
|
||||||
v: val,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Type() string {
|
|
||||||
return r.t
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Value() string {
|
|
||||||
return r.v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Contains(b ucan.Resource) bool {
|
|
||||||
return r.Type() == b.Type() && len(r.Value()) <= len(b.Value())
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
|
||||||
package resvault
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ResVault string
|
|
||||||
|
|
||||||
const (
|
|
||||||
KsEnclave ResVault = "ks/enclave"
|
|
||||||
LocCid ResVault = "loc/cid"
|
|
||||||
LocEntity ResVault = "loc/entity"
|
|
||||||
LocIpns ResVault = "loc/ipns"
|
|
||||||
AddrSonr ResVault = "addr/sonr"
|
|
||||||
ChainCode ResVault = "chain/code"
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns the string representation of ResVault
|
|
||||||
func (rcv ResVault) String() string {
|
|
||||||
return string(rcv)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ encoding.BinaryUnmarshaler = new(ResVault)
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for ResVault.
|
|
||||||
func (rcv *ResVault) UnmarshalBinary(data []byte) error {
|
|
||||||
switch str := string(data); str {
|
|
||||||
case "ks/enclave":
|
|
||||||
*rcv = KsEnclave
|
|
||||||
case "loc/cid":
|
|
||||||
*rcv = LocCid
|
|
||||||
case "loc/entity":
|
|
||||||
*rcv = LocEntity
|
|
||||||
case "loc/ipns":
|
|
||||||
*rcv = LocIpns
|
|
||||||
case "addr/sonr":
|
|
||||||
*rcv = AddrSonr
|
|
||||||
case "chain/code":
|
|
||||||
*rcv = ChainCode
|
|
||||||
default:
|
|
||||||
return fmt.Errorf(`illegal: "%s" is not a valid ResVault`, str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package resvault
|
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/crypto/ucan"
|
|
||||||
|
|
||||||
func Build(ty ResVault, value string) ucan.Resource {
|
|
||||||
return newStringLengthResource(ty.String(), value)
|
|
||||||
}
|
|
||||||
|
|
||||||
type stringLengthRsc struct {
|
|
||||||
t string
|
|
||||||
v string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewStringLengthResource is a silly implementation of resource to use while
|
|
||||||
// I figure out what an OR filter on strings is. Don't use this.
|
|
||||||
func newStringLengthResource(typ, val string) ucan.Resource {
|
|
||||||
return stringLengthRsc{
|
|
||||||
t: typ,
|
|
||||||
v: val,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Type() string {
|
|
||||||
return r.t
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Value() string {
|
|
||||||
return r.v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r stringLengthRsc) Contains(b ucan.Resource) bool {
|
|
||||||
return r.Type() == b.Type() && len(r.Value()) <= len(b.Value())
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# Deployment
|
|
||||||
|
|
||||||
This directory contains the configuration files for deploying the Sonr blockchain.
|
|
||||||
|
|
||||||
## Contents
|
|
||||||
|
|
||||||
- `devnet`: Configuration for deploying the Sonr blockchain on the devnet (local development).
|
|
||||||
- `testnet`: Configuration for deploying the Sonr blockchain on the testnet (current prod setup)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Configuration is automatically loaded from the `PKL` files in the root of the repository. These templates are generated during deployment initialization.
|
|
||||||
|
|
||||||
To deploy the total network, run the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
devbox run <network>
|
|
||||||
```
|
|
||||||
|
|
||||||
Replace `<network>` with either `devnet` or `testnet` from the root of the repository.
|
|
||||||
|
|
||||||
## Components
|
|
||||||
|
|
||||||
### Sonr
|
|
||||||
|
|
||||||
The Sonr blockchain is deployed using the `sonrd` binary. This binary is built using the `Makefile` in the root of the repository.
|
|
||||||
|
|
||||||
### IPFS
|
|
||||||
|
|
||||||
IPFS is deployed using the `ipfs` binary. This binary is built using the `Makefile` in the root of the repository.
|
|
||||||
|
|
||||||
### Hway
|
|
||||||
|
|
||||||
Hway is deployed using the `hway` binary. This binary is built using the `Makefile` in the root of the repository.
|
|
||||||
|
|
||||||
### Synapse
|
|
||||||
|
|
||||||
Synapse is deployed using the `matrix-synapse` binary. This binary is built using the `Makefile` in the root of the repository.
|
|
||||||
|
|
||||||
### Tigerbeetle
|
|
||||||
|
|
||||||
Tigerbeetle is deployed using the `tigerbeetle` binary. This binary is built using the `Makefile` in the root of the repository.
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
import "https://pkl.sh/ipfs.net/0.0.1/Config.pkl"
|
|
||||||
|
|
||||||
API {
|
|
||||||
HTTPHeaders {
|
|
||||||
`Access-Control-Allow-Origin` = new { "*" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Addresses {
|
|
||||||
API = "/ip4/127.0.0.1/tcp/5001"
|
|
||||||
Gateway = "/ip4/127.0.0.1/tcp/8080"
|
|
||||||
Swarm = new {
|
|
||||||
"/ip4/0.0.0.0/tcp/4001"
|
|
||||||
"/ip6/::/tcp/4001"
|
|
||||||
"/ip4/0.0.0.0/udp/4001/quic"
|
|
||||||
"/ip6/::/udp/4001/quic"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bootstrap {
|
|
||||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
|
|
||||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
|
|
||||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
|
|
||||||
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
|
|
||||||
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
|
|
||||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
|
|
||||||
}
|
|
||||||
|
|
||||||
Datastore {
|
|
||||||
BloomFilterSize = 0
|
|
||||||
GCPeriod = "1h"
|
|
||||||
HashOnRead = false
|
|
||||||
StorageGCWatermark = 90
|
|
||||||
StorageMax = "10GB"
|
|
||||||
Spec = new {
|
|
||||||
mounts = new {
|
|
||||||
new {
|
|
||||||
prefix = "flatfs.datastore"
|
|
||||||
child = new {
|
|
||||||
path = "blocks"
|
|
||||||
shardFunc = "/repo/flatfs/shard/v1/next-to-last/2"
|
|
||||||
type = "flatfs"
|
|
||||||
sync = true
|
|
||||||
}
|
|
||||||
mountpoint = "/blocks"
|
|
||||||
type = "measure"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
prefix = "leveldb.datastore"
|
|
||||||
child = new {
|
|
||||||
compression = "none"
|
|
||||||
path = "datastore"
|
|
||||||
type = "levelds"
|
|
||||||
}
|
|
||||||
mountpoint = "/"
|
|
||||||
type = "measure"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type = "mount"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Discovery {
|
|
||||||
MDNS = new {
|
|
||||||
Enabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Experimental {
|
|
||||||
StrategicProviding = false
|
|
||||||
UrlstoreEnabled = false
|
|
||||||
AcceleratedDHTClient = false
|
|
||||||
GraphsyncEnabled = false
|
|
||||||
FilestoreEnabled = false
|
|
||||||
Libp2pStreamMounting = false
|
|
||||||
P2pHttpProxy = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Gateway {
|
|
||||||
HTTPHeaders = new {
|
|
||||||
`Access-Control-Allow-Headers` = new {
|
|
||||||
"X-Requested-With"
|
|
||||||
"Range"
|
|
||||||
"User-Agent"
|
|
||||||
}
|
|
||||||
`Access-Control-Allow-Methods` = new { "GET" }
|
|
||||||
`Access-Control-Allow-Origin` = new { "*" }
|
|
||||||
}
|
|
||||||
NoDNSLink = false
|
|
||||||
NoFetch = false
|
|
||||||
PublicGateways = null
|
|
||||||
RootRedirect = ""
|
|
||||||
Writable = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Identity {
|
|
||||||
PrivKey = "CAESQP0FRhYf5Nvxg0wrbN+VTK7kWdgy+3AKoxU3vNH0K9FHVpXyx6/mHKyCaPjqI11YsHUW0B2ZODGROPafyS6IeWY="
|
|
||||||
PeerID = "12D3KooWFeMr1tHFs8WAF11rKDULJbmKg9rE5aVhYJU23oC7pqjB"
|
|
||||||
}
|
|
||||||
|
|
||||||
Ipns {
|
|
||||||
RecordLifetime = ""
|
|
||||||
RepublishPeriod = ""
|
|
||||||
ResolveCacheSize = 128
|
|
||||||
}
|
|
||||||
|
|
||||||
Migration {
|
|
||||||
Keep = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
Mounts {
|
|
||||||
IPNS = "/ipns"
|
|
||||||
FuseAllowOther = false
|
|
||||||
IPFS = "/ipfs"
|
|
||||||
}
|
|
||||||
|
|
||||||
Peering {
|
|
||||||
Peers = new {
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-1.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-2.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-3.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-4.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfJeB3Js1FG7T8YaZATEiaHqNKVdQfybYYkbT1knUswx"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-5.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfVvzK4tMdFmpJjEKDUoqRgP4W9FnmJoziYX5GXJJ8eZ"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-6.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfZD3VKrUxyP9BbyUnZDpbqDnT7cQ4WjPP8TRLXaoE7G"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-7.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfZP2LuW4jxviTeG8fi28qjnZScACb8PEgHAc17ZEri3"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-8.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfgsJsMtx6qJb74akCw1M24X1zFwgGo11h1cuhwQjtJP"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-9.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "Qmcfr2FC7pFzJbTSDfYaSy1J8Uuy8ccGLeLyqJCKJvTHMi"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-10.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-11.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5"
|
|
||||||
}
|
|
||||||
new {
|
|
||||||
Addrs = new { "/dnsaddr/node-12.ingress.cloudflare-ipfs.com" }
|
|
||||||
ID = "QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Provider {
|
|
||||||
Strategy = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
Pubsub {
|
|
||||||
Router = ""
|
|
||||||
DisableSigning = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Reprovider {
|
|
||||||
Strategy = "all"
|
|
||||||
Interval = "12h"
|
|
||||||
}
|
|
||||||
|
|
||||||
Routing {
|
|
||||||
Methods = null
|
|
||||||
Routers = null
|
|
||||||
Type = "dht"
|
|
||||||
}
|
|
||||||
|
|
||||||
Swarm {
|
|
||||||
AddrFilters = null
|
|
||||||
ConnMgr = new {}
|
|
||||||
DisableBandwidthMetrics = false
|
|
||||||
DisableNatPortMap = false
|
|
||||||
RelayClient = new {}
|
|
||||||
ResourceMgr = new {}
|
|
||||||
Transports = new {
|
|
||||||
Multiplexers = new {}
|
|
||||||
Network = new {}
|
|
||||||
Security = new {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
amends "https://pkl.sh/sonr.chain/0.0.2/App.pkl"
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
amends "https://pkl.sh/sonr.chain/0.0.2/Genesis.pkl"
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
This file defines the database schema for the PostgresQL ("psql") event sink
|
|
||||||
implementation in CometBFT. The operator must create a database and install
|
|
||||||
this schema before using the database to index events.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- The blocks table records metadata about each block.
|
|
||||||
-- The block record does not include its events or transactions (see tx_results).
|
|
||||||
CREATE TABLE blocks (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
height BIGINT NOT NULL,
|
|
||||||
chain_id VARCHAR NOT NULL,
|
|
||||||
|
|
||||||
-- When this block header was logged into the sink, in UTC.
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
|
|
||||||
UNIQUE (height, chain_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Index blocks by height and chain, since we need to resolve block IDs when
|
|
||||||
-- indexing transaction records and transaction events.
|
|
||||||
CREATE INDEX idx_blocks_height_chain ON blocks(height, chain_id);
|
|
||||||
|
|
||||||
-- The tx_results table records metadata about transaction results. Note that
|
|
||||||
-- the events from a transaction are stored separately.
|
|
||||||
CREATE TABLE tx_results (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
-- The block to which this transaction belongs.
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
-- The sequential index of the transaction within the block.
|
|
||||||
index INTEGER NOT NULL,
|
|
||||||
-- When this result record was logged into the sink, in UTC.
|
|
||||||
created_at TIMESTAMPTZ NOT NULL,
|
|
||||||
-- The hex-encoded hash of the transaction.
|
|
||||||
tx_hash VARCHAR NOT NULL,
|
|
||||||
-- The protobuf wire encoding of the TxResult message.
|
|
||||||
tx_result BYTEA NOT NULL,
|
|
||||||
|
|
||||||
UNIQUE (block_id, index)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- The events table records events. All events (both block and transaction) are
|
|
||||||
-- associated with a block ID; transaction events also have a transaction ID.
|
|
||||||
CREATE TABLE events (
|
|
||||||
rowid BIGSERIAL PRIMARY KEY,
|
|
||||||
|
|
||||||
-- The block and transaction this event belongs to.
|
|
||||||
-- If tx_id is NULL, this is a block event.
|
|
||||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
|
||||||
tx_id BIGINT NULL REFERENCES tx_results(rowid),
|
|
||||||
|
|
||||||
-- The application-defined type label for the event.
|
|
||||||
type VARCHAR NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
-- The attributes table records event attributes.
|
|
||||||
CREATE TABLE attributes (
|
|
||||||
event_id BIGINT NOT NULL REFERENCES events(rowid),
|
|
||||||
key VARCHAR NOT NULL, -- bare key
|
|
||||||
composite_key VARCHAR NOT NULL, -- composed type.key
|
|
||||||
value VARCHAR NULL,
|
|
||||||
|
|
||||||
UNIQUE (event_id, key)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- A joined view of events and their attributes. Events that do not have any
|
|
||||||
-- attributes are represented as a single row with empty key and value fields.
|
|
||||||
CREATE VIEW event_attributes AS
|
|
||||||
SELECT block_id, tx_id, type, key, composite_key, value
|
|
||||||
FROM events LEFT JOIN attributes ON (events.rowid = attributes.event_id);
|
|
||||||
|
|
||||||
-- A joined view of all block events (those having tx_id NULL).
|
|
||||||
CREATE VIEW block_events AS
|
|
||||||
SELECT blocks.rowid as block_id, height, chain_id, type, key, composite_key, value
|
|
||||||
FROM blocks JOIN event_attributes ON (blocks.rowid = event_attributes.block_id)
|
|
||||||
WHERE event_attributes.tx_id IS NULL;
|
|
||||||
|
|
||||||
-- A joined view of all transaction events.
|
|
||||||
CREATE VIEW tx_events AS
|
|
||||||
SELECT height, index, chain_id, type, key, composite_key, value, tx_results.created_at
|
|
||||||
FROM blocks JOIN tx_results ON (blocks.rowid = tx_results.block_id)
|
|
||||||
JOIN event_attributes ON (tx_results.rowid = event_attributes.tx_id)
|
|
||||||
WHERE event_attributes.tx_id IS NOT NULL;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
version: "0.6"
|
|
||||||
|
|
||||||
processes:
|
|
||||||
sonr:
|
|
||||||
namespace: devnet
|
|
||||||
command: "make sh-testnet"
|
|
||||||
|
|
||||||
hway:
|
|
||||||
namespace: devnet
|
|
||||||
command: "./build/hway"
|
|
||||||
depends:
|
|
||||||
- sonr
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
site
|
||||||
|
.DS_Store
|
||||||
|
tmp
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<div style="text-align: center;">
|
|
||||||
|
|
||||||
# Page Not Found
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The page you were looking for couldn't be found.
|
|
||||||
|
|
||||||
Press [[/]] to search, or [head back to the homepage](/).
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Sonr Blockchain
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<div style="text-align: center;">
|
|
||||||
|
|
||||||
# Page Not Found
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The page you were looking for couldn't be found.
|
|
||||||
|
|
||||||
Press [[/]] to search, or [head back to the homepage](/).
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,569 @@
|
|||||||
|
# Protocol Buffers in Cosmos SDK
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The Cosmos SDK uses Protocol Buffers for serialization and API definitions. Generation is handled via a Docker image: `ghcr.io/cosmos/proto-builder:0.15.x`.
|
||||||
|
|
||||||
|
## Generation Tools
|
||||||
|
|
||||||
|
- **Buf**: Primary tool for protobuf management
|
||||||
|
- **protocgen.sh**: Core generation script in `scripts/`
|
||||||
|
- **Makefile Commands**: Standard commands for generate, lint, format
|
||||||
|
|
||||||
|
## Key Components
|
||||||
|
|
||||||
|
### Buf Configuration
|
||||||
|
|
||||||
|
1. **Workspace Setup**
|
||||||
|
- Root level buf workspace configuration
|
||||||
|
- Manages multiple protobuf directories
|
||||||
|
|
||||||
|
2. **Directory Structure**
|
||||||
|
```
|
||||||
|
proto/
|
||||||
|
├── buf.gen.gogo.yaml # GoGo Protobuf generation
|
||||||
|
├── buf.gen.pulsar.yaml # Pulsar API generation
|
||||||
|
├── buf.gen.swagger.yaml # OpenAPI/Swagger docs
|
||||||
|
├── buf.lock # Dependencies
|
||||||
|
├── buf.yaml # Core configuration
|
||||||
|
├── cosmos/ # Core protos
|
||||||
|
└── tendermint/ # Consensus protos
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Module Protos**
|
||||||
|
- Located in `x/{moduleName}/proto`
|
||||||
|
- Module-specific message definitions
|
||||||
|
|
||||||
|
#### `buf.gen.gogo.yaml`
|
||||||
|
|
||||||
|
`buf.gen.gogo.yaml` defines how the protobuf files should be generated for use with in the module. This file uses [gogoproto](https://github.com/gogo/protobuf), a separate generator from the google go-proto generator that makes working with various objects more ergonomic, and it has more performant encode and decode steps
|
||||||
|
|
||||||
|
```go reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.gogo.yaml#L1-L9
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `buf.gen.pulsar.yaml`
|
||||||
|
|
||||||
|
`buf.gen.pulsar.yaml` defines how protobuf files should be generated using the [new golang apiv2 of protobuf](https://go.dev/blog/protobuf-apiv2). This generator is used instead of the google go-proto generator because it has some extra helpers for Cosmos SDK applications and will have more performant encode and decode than the google go-proto generator. You can follow the development of this generator [here](https://github.com/cosmos/cosmos-proto).
|
||||||
|
|
||||||
|
```go reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.pulsar.yaml#L1-L18
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `buf.gen.swagger.yaml`
|
||||||
|
|
||||||
|
`buf.gen.swagger.yaml` generates the swagger documentation for the query and messages of the chain. This will only define the REST API end points that were defined in the query and msg servers. You can find examples of this [here](https://github.com/cosmos/cosmos-sdk/blob/main/x/bank/proto/cosmos/bank/v1beta1/query.proto)
|
||||||
|
|
||||||
|
```go reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.swagger.yaml#L1-L6
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `buf.lock`
|
||||||
|
|
||||||
|
This is an autogenerated file based off the dependencies required by the `.gen` files. There is no need to copy the current one. If you depend on cosmos-sdk proto definitions a new entry for the Cosmos SDK will need to be provided. The dependency you will need to use is `buf.build/cosmos/cosmos-sdk`.
|
||||||
|
|
||||||
|
```go reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.lock#L1-L16
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `buf.yaml`
|
||||||
|
|
||||||
|
`buf.yaml` defines the [name of your package](https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L3), which [breakage checker](https://buf.build/docs/tutorials/getting-started-with-buf-cli#detect-breaking-changes) to use and how to [lint your protobuf files](https://buf.build/docs/tutorials/getting-started-with-buf-cli#lint-your-api).
|
||||||
|
|
||||||
|
It is advised to use a tagged version of the buf modules corresponding to the version of the Cosmos SDK being are used.
|
||||||
|
|
||||||
|
```go reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L1-L24
|
||||||
|
```
|
||||||
|
|
||||||
|
We use a variety of linters for the Cosmos SDK protobuf files. The repo also checks this in ci.
|
||||||
|
A reference to the github actions can be found [here](https://github.com/cosmos/cosmos-sdk/blob/main/.github/workflows/proto.yml#L1-L32)
|
||||||
|
|
||||||
|
# ORM
|
||||||
|
|
||||||
|
The Cosmos SDK ORM is a state management library that provides a rich, but opinionated set of tools for managing a
|
||||||
|
module's state. It provides support for:
|
||||||
|
|
||||||
|
- type safe management of state
|
||||||
|
- multipart keys
|
||||||
|
- secondary indexes
|
||||||
|
- unique indexes
|
||||||
|
- easy prefix and range queries
|
||||||
|
- automatic genesis import/export
|
||||||
|
- automatic query services for clients, including support for light client proofs (still in development)
|
||||||
|
- indexing state data in external databases (still in development)
|
||||||
|
|
||||||
|
## Design and Philosophy
|
||||||
|
|
||||||
|
The ORM's data model is inspired by the relational data model found in SQL databases. The core abstraction is a table
|
||||||
|
with a primary key and optional secondary indexes.
|
||||||
|
|
||||||
|
Because the Cosmos SDK uses protobuf as its encoding layer, ORM tables are defined directly in .proto files using
|
||||||
|
protobuf options. Each table is defined by a single protobuf `message` type and a schema of multiple tables is
|
||||||
|
represented by a single .proto file.
|
||||||
|
|
||||||
|
Table structure is specified in the same file where messages are defined in order to make it easy to focus on better
|
||||||
|
design of the state layer. Because blockchain state layout is part of the public API for clients (TODO: link to docs on
|
||||||
|
light client proofs), it is important to think about the state layout as being part of the public API of a module.
|
||||||
|
Changing the state layout actually breaks clients, so it is ideal to think through it carefully up front and to aim for
|
||||||
|
a design that will eliminate or minimize breaking changes down the road. Also, good design of state enables building
|
||||||
|
more performant and sophisticated applications. Providing users with a set of tools inspired by relational databases
|
||||||
|
which have a long history of database design best practices and allowing schema to be specified declaratively in a
|
||||||
|
single place are design choices the ORM makes to enable better design and more durable APIs.
|
||||||
|
|
||||||
|
Also, by only supporting the table abstraction as opposed to key-value pair maps, it is easy to add to new
|
||||||
|
columns/fields to any data structure without causing a breaking change and the data structures can easily be indexed in
|
||||||
|
any off-the-shelf SQL database for more sophisticated queries.
|
||||||
|
|
||||||
|
The encoding of fields in keys is designed to support ordered iteration for all protobuf primitive field types
|
||||||
|
except for `bytes` as well as the well-known types `google.protobuf.Timestamp` and `google.protobuf.Duration`. Encodings
|
||||||
|
are optimized for storage space when it makes sense (see the documentation in `cosmos/orm/v1/orm.proto` for more details)
|
||||||
|
and table rows do not use extra storage space to store key fields in the value.
|
||||||
|
|
||||||
|
We recommend that users of the ORM attempt to follow database design best practices such as
|
||||||
|
[normalization](https://en.wikipedia.org/wiki/Database_normalization) (at least 1NF).
|
||||||
|
For instance, defining `repeated` fields in a table is considered an anti-pattern because breaks first normal form (1NF).
|
||||||
|
Although we support `repeated` fields in tables, they cannot be used as key fields for this reason. This may seem
|
||||||
|
restrictive but years of best practice (and also experience in the SDK) have shown that following this pattern
|
||||||
|
leads to easier to maintain schemas.
|
||||||
|
|
||||||
|
To illustrate the motivation for these principles with an example from the SDK, historically balances were stored
|
||||||
|
as a mapping from account -> map of denom to amount. This did not scale well because an account with 100 token balances
|
||||||
|
needed to be encoded/decoded every time a single coin balance changed. Now balances are stored as account,denom -> amount
|
||||||
|
as in the example above. With the ORM's data model, if we wanted to add a new field to `Balance` such as
|
||||||
|
`unlocked_balance` (if vesting accounts were redesigned in this way), it would be easy to add it to this table without
|
||||||
|
requiring a data migration. Because of the ORM's optimizations, the account and denom are only stored in the key part
|
||||||
|
of storage and not in the value leading to both a flexible data model and efficient usage of storage.
|
||||||
|
|
||||||
|
## Defining Tables
|
||||||
|
|
||||||
|
To define a table:
|
||||||
|
|
||||||
|
1. create a .proto file to describe the module's state (naming it `state.proto` is recommended for consistency),
|
||||||
|
and import "cosmos/orm/v1/orm.proto", ex:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
syntax = "proto3";
|
||||||
|
package bank_example;
|
||||||
|
|
||||||
|
import "cosmos/orm/v1/orm.proto";
|
||||||
|
```
|
||||||
|
|
||||||
|
2. define a `message` for the table, ex:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Balance {
|
||||||
|
bytes account = 1;
|
||||||
|
string denom = 2;
|
||||||
|
uint64 balance = 3;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. add the `cosmos.orm.v1.table` option to the table and give the table an `id` unique within this .proto file:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Balance {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
bytes account = 1;
|
||||||
|
string denom = 2;
|
||||||
|
uint64 balance = 3;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. define the primary key field or fields, as a comma-separated list of the fields from the message which should make
|
||||||
|
up the primary key:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Balance {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 1
|
||||||
|
primary_key: { fields: "account,denom" }
|
||||||
|
};
|
||||||
|
|
||||||
|
bytes account = 1;
|
||||||
|
string denom = 2;
|
||||||
|
uint64 balance = 3;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. add any desired secondary indexes by specifying an `id` unique within the table and a comma-separate list of the
|
||||||
|
index fields:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Balance {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 1;
|
||||||
|
primary_key: { fields: "account,denom" }
|
||||||
|
index: { id: 1 fields: "denom" } // this allows querying for the accounts which own a denom
|
||||||
|
};
|
||||||
|
|
||||||
|
bytes account = 1;
|
||||||
|
string denom = 2;
|
||||||
|
uint64 amount = 3;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Auto-incrementing Primary Keys
|
||||||
|
|
||||||
|
A common pattern in SDK modules and in database design is to define tables with a single integer `id` field with an
|
||||||
|
automatically generated primary key. In the ORM we can do this by setting the `auto_increment` option to `true` on the
|
||||||
|
primary key, ex:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Account {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 2;
|
||||||
|
primary_key: { fields: "id", auto_increment: true }
|
||||||
|
};
|
||||||
|
|
||||||
|
uint64 id = 1;
|
||||||
|
bytes address = 2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unique Indexes
|
||||||
|
|
||||||
|
A unique index can be added by setting the `unique` option to `true` on an index, ex:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Account {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 2;
|
||||||
|
primary_key: { fields: "id", auto_increment: true }
|
||||||
|
index: {id: 1, fields: "address", unique: true}
|
||||||
|
};
|
||||||
|
|
||||||
|
uint64 id = 1;
|
||||||
|
bytes address = 2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Singletons
|
||||||
|
|
||||||
|
The ORM also supports a special type of table with only one row called a `singleton`. This can be used for storing
|
||||||
|
module parameters. Singletons only need to define a unique `id` and that cannot conflict with the id of other
|
||||||
|
tables or singletons in the same .proto file. Ex:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
message Params {
|
||||||
|
option (cosmos.orm.v1.singleton) = {
|
||||||
|
id: 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
google.protobuf.Duration voting_period = 1;
|
||||||
|
uint64 min_threshold = 2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running Codegen
|
||||||
|
|
||||||
|
NOTE: the ORM will only work with protobuf code that implements the [google.golang.org/protobuf](https://pkg.go.dev/google.golang.org/protobuf)
|
||||||
|
API. That means it will not work with code generated using gogo-proto.
|
||||||
|
|
||||||
|
To install the ORM's code generator, run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
The recommended way to run the code generator is to use [buf build](https://docs.buf.build/build/usage).
|
||||||
|
This is an example `buf.gen.yaml` that runs `protoc-gen-go`, `protoc-gen-go-grpc` and `protoc-gen-go-cosmos-orm`
|
||||||
|
using buf managed mode:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: v1
|
||||||
|
managed:
|
||||||
|
enabled: true
|
||||||
|
go_package_prefix:
|
||||||
|
default: foo.bar/api # the go package prefix of your package
|
||||||
|
override:
|
||||||
|
buf.build/cosmos/cosmos-sdk: cosmossdk.io/api # required to import the Cosmos SDK api module
|
||||||
|
plugins:
|
||||||
|
- name: go
|
||||||
|
out: .
|
||||||
|
opt: paths=source_relative
|
||||||
|
- name: go-grpc
|
||||||
|
out: .
|
||||||
|
opt: paths=source_relative
|
||||||
|
- name: go-cosmos-orm
|
||||||
|
out: .
|
||||||
|
opt: paths=source_relative
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using the ORM in a module
|
||||||
|
|
||||||
|
### Initialization
|
||||||
|
|
||||||
|
To use the ORM in a module, first create a `ModuleSchemaDescriptor`. This tells the ORM which .proto files have defined
|
||||||
|
an ORM schema and assigns them all a unique non-zero id. Ex:
|
||||||
|
|
||||||
|
```go
|
||||||
|
var MyModuleSchema = &ormv1alpha1.ModuleSchemaDescriptor{
|
||||||
|
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||||
|
{
|
||||||
|
Id: 1,
|
||||||
|
ProtoFileName: mymodule.File_my_module_state_proto.Path(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In the ORM generated code for a file named `state.proto`, there should be an interface `StateStore` that got generated
|
||||||
|
with a constructor `NewStateStore` that takes a parameter of type `ormdb.ModuleDB`. Add a reference to `StateStore`
|
||||||
|
to your module's keeper struct. Ex:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Keeper struct {
|
||||||
|
db StateStore
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then instantiate the `StateStore` instance via an `ormdb.ModuleDB` that is instantiated from the `SchemaDescriptor`
|
||||||
|
above and one or more store services from `cosmossdk.io/core/store`. Ex:
|
||||||
|
|
||||||
|
```go
|
||||||
|
func NewKeeper(storeService store.KVStoreService) (*Keeper, error) {
|
||||||
|
modDb, err := ormdb.NewModuleDB(MyModuleSchema, ormdb.ModuleDBOptions{KVStoreService: storeService})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
db, err := NewStateStore(modDb)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return Keeper{db: db}, nil
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the generated code
|
||||||
|
|
||||||
|
The generated code for the ORM contains methods for inserting, updating, deleting and querying table entries.
|
||||||
|
For each table in a .proto file, there is a type-safe table interface implemented in generated code. For instance,
|
||||||
|
for a table named `Balance` there should be a `BalanceTable` interface that looks like this:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type BalanceTable interface {
|
||||||
|
Insert(ctx context.Context, balance *Balance) error
|
||||||
|
Update(ctx context.Context, balance *Balance) error
|
||||||
|
Save(ctx context.Context, balance *Balance) error
|
||||||
|
Delete(ctx context.Context, balance *Balance) error
|
||||||
|
Has(ctx context.Context, account []byte, denom string) (found bool, err error)
|
||||||
|
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||||
|
Get(ctx context.Context, account []byte, denom string) (*Balance, error)
|
||||||
|
List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
|
||||||
|
ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
|
||||||
|
DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error
|
||||||
|
DeleteRange(ctx context.Context, from, to BalanceIndexKey) error
|
||||||
|
|
||||||
|
doNotImplement()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This `BalanceTable` should be accessible from the `StateStore` interface (assuming our file is named `state.proto`)
|
||||||
|
via a `BalanceTable()` accessor method. If all the above example tables/singletons were in the same `state.proto`,
|
||||||
|
then `StateStore` would get generated like this:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type BankStore interface {
|
||||||
|
BalanceTable() BalanceTable
|
||||||
|
AccountTable() AccountTable
|
||||||
|
ParamsTable() ParamsTable
|
||||||
|
|
||||||
|
doNotImplement()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
So to work with the `BalanceTable` in a keeper method we could use code like this:
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k keeper) AddBalance(ctx context.Context, acct []byte, denom string, amount uint64) error {
|
||||||
|
balance, err := k.db.BalanceTable().Get(ctx, acct, denom)
|
||||||
|
if err != nil && !ormerrors.IsNotFound(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if balance == nil {
|
||||||
|
balance = &Balance{
|
||||||
|
Account: acct,
|
||||||
|
Denom: denom,
|
||||||
|
Amount: amount,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
balance.Amount = balance.Amount + amount
|
||||||
|
}
|
||||||
|
|
||||||
|
return k.db.BalanceTable().Save(ctx, balance)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`List` methods take `IndexKey` parameters. For instance, `BalanceTable.List` takes `BalanceIndexKey`. `BalanceIndexKey`
|
||||||
|
let's represent index keys for the different indexes (primary and secondary) on the `Balance` table. The primary key
|
||||||
|
in the `Balance` table gets a struct `BalanceAccountDenomIndexKey` and the first index gets an index key `BalanceDenomIndexKey`.
|
||||||
|
If we wanted to list all the denoms and amounts that an account holds, we would use `BalanceAccountDenomIndexKey`
|
||||||
|
with a `List` query just on the account prefix. Ex:
|
||||||
|
|
||||||
|
```go
|
||||||
|
it, err := keeper.db.BalanceTable().List(ctx, BalanceAccountDenomIndexKey{}.WithAccount(acct))
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## sidebar_position: 1
|
||||||
|
|
||||||
|
# ProtocolBuffer Annotations
|
||||||
|
|
||||||
|
This document explains the various protobuf scalars that have been added to make working with protobuf easier for Cosmos SDK application developers
|
||||||
|
|
||||||
|
## Signer
|
||||||
|
|
||||||
|
Signer specifies which field should be used to determine the signer of a message for the Cosmos SDK. This field can be used for clients as well to infer which field should be used to determine the signer of a message.
|
||||||
|
|
||||||
|
Read more about the signer field [here](./02-messages-and-queries.md).
|
||||||
|
|
||||||
|
```protobuf reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e6848d99b55a65d014375b295bdd7f9641aac95e/proto/cosmos/bank/v1beta1/tx.proto#L40
|
||||||
|
```
|
||||||
|
|
||||||
|
```proto
|
||||||
|
option (cosmos.msg.v1.signer) = "from_address";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Scalar
|
||||||
|
|
||||||
|
The scalar type defines a way for clients to understand how to construct protobuf messages according to what is expected by the module and sdk.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
(cosmos_proto.scalar) = "cosmos.AddressString"
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of account address string scalar:
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e6848d99b55a65d014375b295bdd7f9641aac95e/proto/cosmos/bank/v1beta1/tx.proto#L46
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of validator address string scalar:
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/query.proto#L87
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of pubkey scalar:
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/11068bfbcd44a7db8af63b6a8aa079b1718f6040/proto/cosmos/staking/v1beta1/tx.proto#L94
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of Decimals scalar:
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/distribution.proto#L26
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of Int scalar:
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/gov/v1/gov.proto#L137
|
||||||
|
```
|
||||||
|
|
||||||
|
There are a few options for what can be provided as a scalar: `cosmos.AddressString`, `cosmos.ValidatorAddressString`, `cosmos.ConsensusAddressString`, `cosmos.Int`, `cosmos.Dec`.
|
||||||
|
|
||||||
|
## Implements_Interface
|
||||||
|
|
||||||
|
Implement interface is used to provide information to client tooling like [telescope](https://github.com/cosmology-tech/telescope) on how to encode and decode protobuf messages.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.AccountI";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Method,Field,Message Added In
|
||||||
|
|
||||||
|
`method_added_in`, `field_added_in` and `message_added_in` are annotations to denotate to clients that a field has been supported in a later version. This is useful when new methods or fields are added in later versions and that the client needs to be aware of what it can call.
|
||||||
|
|
||||||
|
The annotation should be worded as follow:
|
||||||
|
|
||||||
|
```proto
|
||||||
|
option (cosmos_proto.method_added_in) = "cosmos-sdk v0.50.1";
|
||||||
|
option (cosmos_proto.method_added_in) = "x/epochs v1.0.0";
|
||||||
|
option (cosmos_proto.method_added_in) = "simapp v24.0.0";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Amino
|
||||||
|
|
||||||
|
The amino codec was removed in `v0.50+`, this means there is not a need register `legacyAminoCodec`. To replace the amino codec, Amino protobuf annotations are used to provide information to the amino codec on how to encode and decode protobuf messages.
|
||||||
|
|
||||||
|
:::note
|
||||||
|
Amino annotations are only used for backwards compatibility with amino. New modules are not required use amino annotations.
|
||||||
|
:::
|
||||||
|
|
||||||
|
The below annotations are used to provide information to the amino codec on how to encode and decode protobuf messages in a backwards compatible manner.
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
Name specifies the amino name that would show up for the user in order for them see which message they are signing.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
option (amino.name) = "cosmos-sdk/BaseAccount";
|
||||||
|
```
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/tx.proto#L41
|
||||||
|
```
|
||||||
|
|
||||||
|
### Field_Name
|
||||||
|
|
||||||
|
Field name specifies the amino name that would show up for the user in order for them see which field they are signing.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
uint64 height = 1 [(amino.field_name) = "public_key"];
|
||||||
|
```
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/distribution.proto#L166
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dont_OmitEmpty
|
||||||
|
|
||||||
|
Dont omitempty specifies that the field should not be omitted when encoding to amino.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
repeated cosmos.base.v1beta1.Coin amount = 3 [(amino.dont_omitempty) = true];
|
||||||
|
```
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/bank.proto#L56
|
||||||
|
```
|
||||||
|
|
||||||
|
### Encoding
|
||||||
|
|
||||||
|
Encoding instructs the amino json marshaler how to encode certain fields that may differ from the standard encoding behaviour. The most common example of this is how `repeated cosmos.base.v1beta1.Coin` is encoded when using the amino json encoding format. The `legacy_coins` option tells the json marshaler [how to encode a null slice](https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/x/tx/signing/aminojson/json_marshal.go#L65) of `cosmos.base.v1beta1.Coin`.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
(amino.encoding) = "legacy_coins",
|
||||||
|
```
|
||||||
|
|
||||||
|
```proto reference
|
||||||
|
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/genesis.proto#L23
|
||||||
|
```
|
||||||
|
|
||||||
|
Another example is a protobuf `bytes` that contains a valid JSON document.
|
||||||
|
The `inline_json` option tells the json marshaler to embed the JSON bytes into the wrapping document without escaping.
|
||||||
|
|
||||||
|
```proto
|
||||||
|
(amino.encoding) = "inline_json",
|
||||||
|
```
|
||||||
|
|
||||||
|
E.g. the bytes containing `{"foo":123}` in the `envelope` field would lead to the following JSON:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"envelope": {
|
||||||
|
"foo": 123
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If the bytes are not valid JSON, this leads to JSON broken documents. Thus a JSON validity check needs to be in place at some point of the process.
|
||||||
@@ -0,0 +1,627 @@
|
|||||||
|
# RFC 004: Account System Refactor
|
||||||
|
|
||||||
|
## Status
|
||||||
|
- Draft v2 (May 2023)
|
||||||
|
|
||||||
|
## Current Limitations
|
||||||
|
|
||||||
|
1. **Account Representation**: Limited by `google.Protobuf.Any` encapsulation and basic authentication methods
|
||||||
|
2. **Interface Constraints**: Lacks support for advanced functionalities like vesting and complex auth systems
|
||||||
|
3. **Implementation Rigidity**: Poor differentiation between account types (e.g., `ModuleAccount`)
|
||||||
|
4. **Authorization System**: Basic `x/auth` module with limited scope beyond `x/bank` functionality
|
||||||
|
5. **Dependency Issues**: Cyclic dependencies between modules (e.g., `x/auth` ↔ `x/bank` for vesting)
|
||||||
|
|
||||||
|
## Proposal
|
||||||
|
|
||||||
|
This proposal aims to transform the way accounts are managed within the Cosmos SDK by introducing significant changes to
|
||||||
|
their structure and functionality.
|
||||||
|
|
||||||
|
### Rethinking Account Representation and Business Logic
|
||||||
|
|
||||||
|
Instead of representing accounts as simple `google.Protobuf.Any` structures stored in state with no business logic
|
||||||
|
attached, this proposal suggests a more sophisticated account representation that is closer to module entities.
|
||||||
|
In fact, accounts should be able to receive messages and process them in the same way modules do, and be capable of storing
|
||||||
|
state in a isolated (prefixed) portion of state belonging only to them, in the same way as modules do.
|
||||||
|
|
||||||
|
### Account Message Reception
|
||||||
|
|
||||||
|
We propose that accounts should be able to receive messages in the same way modules can, allowing them to manage their
|
||||||
|
own state modifications without relying on other modules. This change would enable more advanced account functionality, such as the
|
||||||
|
`VestingAccount` example, where the x/bank module previously needed to change the vestingState by casting the abstracted
|
||||||
|
account to `VestingAccount` and triggering the `TrackDelegation` call. Accounts are already capable of sending messages when
|
||||||
|
a state transition, originating from a transaction, is executed.
|
||||||
|
|
||||||
|
When accounts receive messages, they will be able to identify the sender of the message and decide how to process the
|
||||||
|
state transition, if at all.
|
||||||
|
|
||||||
|
### Consequences
|
||||||
|
|
||||||
|
These changes would have significant implications for the Cosmos SDK, resulting in a system of actors that are equal from
|
||||||
|
the runtime perspective. The runtime would only be responsible for propagating messages between actors and would not
|
||||||
|
manage the authorization system. Instead, actors would manage their own authorizations. For instance, there would be no
|
||||||
|
need for the `x/auth` module to manage minting or burning of coins permissions, as it would fall within the scope of the
|
||||||
|
`x/bank` module.
|
||||||
|
|
||||||
|
The key difference between accounts and modules would lie in the origin of the message (state transition). Accounts
|
||||||
|
(ExternallyOwnedAccount), which have credentials (e.g., a public/private key pairing), originate state transitions from
|
||||||
|
transactions. In contrast, module state transitions do not have authentication credentials backing them and can be
|
||||||
|
caused by two factors: either as a consequence of a state transition coming from a transaction or triggered by a scheduler
|
||||||
|
(e.g., the runtime's Begin/EndBlock).
|
||||||
|
|
||||||
|
By implementing these proposed changes, the Cosmos SDK will benefit from a more extensible, versatile, and efficient account
|
||||||
|
management system that is better suited to address the requirements of the Cosmos ecosystem.
|
||||||
|
|
||||||
|
#### Standardization
|
||||||
|
|
||||||
|
With `x/accounts` allowing a modular api there becomes a need for standardization of accounts or the interfaces wallets and other clients should expect to use. For this reason we will be using the [`CIP` repo](https://github.com/cosmos/cips) in order to standardize interfaces in order for wallets to know what to expect when interacting with accounts.
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
### Account Definition
|
||||||
|
|
||||||
|
We define the new `Account` type, which is what an account needs to implement to be treated as such.
|
||||||
|
An `Account` type is defined at APP level, so it cannot be dynamically loaded as the chain is running without upgrading the
|
||||||
|
node code, unless we create something like a `CosmWasmAccount` which is an account backed by an `x/wasm` contract.
|
||||||
|
|
||||||
|
```go
|
||||||
|
// Account is what the developer implements to define an account.
|
||||||
|
type Account[InitMsg proto.Message] interface {
|
||||||
|
// Init is the function that initialises an account instance of a given kind.
|
||||||
|
// InitMsg is used to initialise the initial state of an account.
|
||||||
|
Init(ctx *Context, msg InitMsg) error
|
||||||
|
// RegisterExecuteHandlers registers an account's execution messages.
|
||||||
|
RegisterExecuteHandlers(executeRouter *ExecuteRouter)
|
||||||
|
// RegisterQueryHandlers registers an account's query messages.
|
||||||
|
RegisterQueryHandlers(queryRouter *QueryRouter)
|
||||||
|
// RegisterMigrationHandlers registers an account's migration messages.
|
||||||
|
RegisterMigrationHandlers(migrationRouter *MigrationRouter)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### The InternalAccount definition
|
||||||
|
|
||||||
|
The public `Account` interface implementation is then converted by the runtime into an `InternalAccount` implementation,
|
||||||
|
which contains all the information and business logic needed to operate the account.
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Schema struct {
|
||||||
|
state StateSchema // represents the state of an account
|
||||||
|
init InitSchema // represents the init msg schema
|
||||||
|
exec ExecSchema // represents the multiple execution msg schemas, containing also responses
|
||||||
|
query QuerySchema // represents the multiple query msg schemas, containing also responses
|
||||||
|
migrate *MigrateSchema // represents the multiple migrate msg schemas, containing also responses, it's optional
|
||||||
|
}
|
||||||
|
|
||||||
|
type InternalAccount struct {
|
||||||
|
init func(ctx *Context, msg proto.Message) (*InitResponse, error)
|
||||||
|
execute func(ctx *Context, msg proto.Message) (*ExecuteResponse, error)
|
||||||
|
query func(ctx *Context, msg proto.Message) (proto.Message, error)
|
||||||
|
schema func() *Schema
|
||||||
|
migrate func(ctx *Context, msg proto.Message) (*MigrateResponse, error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is an internal view of the account as intended by the system. It is not meant to be what developers implement. An
|
||||||
|
example implementation of the `InternalAccount` type can be found in [this](https://github.com/testinginprod/accounts-poc/blob/main/examples/recover/recover.go)
|
||||||
|
example of account whose credentials can be recovered. In fact, even if the `Internal` implementation is untyped (with
|
||||||
|
respect to `proto.Message`), the concrete implementation is fully typed.
|
||||||
|
|
||||||
|
During any of the execution methods of `InternalAccount`, `schema` excluded, the account is given a `Context` which provides:
|
||||||
|
|
||||||
|
- A namespaced `KVStore` for the account, which isolates the account state from others (NOTE: no `store keys` needed,
|
||||||
|
the account address serves as `store key`).
|
||||||
|
- Information regarding itself (its address)
|
||||||
|
- Information regarding the sender.
|
||||||
|
- ...
|
||||||
|
|
||||||
|
#### Init
|
||||||
|
|
||||||
|
Init defines the entrypoint that allows for a new account instance of a given kind to be initialised.
|
||||||
|
The account is passed some opaque protobuf message which is then interpreted and contains the instructions that
|
||||||
|
constitute the initial state of an account once it is deployed.
|
||||||
|
|
||||||
|
An `Account` code can be deployed multiple times through the `Init` function, similar to how a `CosmWasm` contract code
|
||||||
|
can be deployed (Instantiated) multiple times.
|
||||||
|
|
||||||
|
#### Execute
|
||||||
|
|
||||||
|
Execute defines the entrypoint that allows an `Account` to process a state transition, the account can decide then how to
|
||||||
|
process the state transition based on the message provided and the sender of the transition.
|
||||||
|
|
||||||
|
#### Query
|
||||||
|
|
||||||
|
Query defines a read-only entrypoint that provides a stable interface that links an account with its state. The reason for
|
||||||
|
which `Query` is still being preferred as an addition to raw state reflection is to:
|
||||||
|
|
||||||
|
- Provide a stable interface for querying (state can be optimised and change more frequently than a query)
|
||||||
|
- Provide a way to define an account `Interface` with respect to its `Read/Write` paths.
|
||||||
|
- Provide a way to query information that cannot be processed from raw state reflection, ex: compute information from lazy
|
||||||
|
state that has not been yet concretely processed (eg: balances with respect to lazy inputs/outputs)
|
||||||
|
|
||||||
|
#### Schema
|
||||||
|
|
||||||
|
Schema provides the definition of an account from `API` perspective, and it's the only thing that should be taken into account
|
||||||
|
when interacting with an account from another account or module, for example: an account is an `authz-interface` account if
|
||||||
|
it has the following message in its execution messages `MsgProxyStateTransition{ state_transition: google.Protobuf.Any }`.
|
||||||
|
|
||||||
|
### Migrate
|
||||||
|
|
||||||
|
Migrate defines the entrypoint that allows an `Account` to migrate its state from a previous version to a new one. Migrations
|
||||||
|
can be initiated only by the account itself, concretely this means that the migrate action sender can only be the account address
|
||||||
|
itself, if the account wants to allow another address to migrate it on its behalf then it could create an execution message
|
||||||
|
that makes the account migrate itself.
|
||||||
|
|
||||||
|
### x/accounts module
|
||||||
|
|
||||||
|
In order to create accounts we define a new module `x/accounts`, note that `x/accounts` deploys account with no authentication
|
||||||
|
credentials attached to it which means no action of an account can be incepted from a TX, we will later explore how the
|
||||||
|
`x/authn` module uses `x/accounts` to deploy authenticated accounts.
|
||||||
|
|
||||||
|
This also has another important implication for which account addresses are now fully decoupled from the authentication mechanism
|
||||||
|
which makes in turn off-chain operations a little more complex, as the chain becomes the real link between account identifier
|
||||||
|
and credentials.
|
||||||
|
|
||||||
|
We could also introduce a way to deterministically compute the account address.
|
||||||
|
|
||||||
|
Note, from the transaction point of view, the `init_message` and `execute_message` are opaque `google.Protobuf.Any`.
|
||||||
|
|
||||||
|
The module protobuf definition for `x/accounts` are the following:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
// Msg defines the Msg service.
|
||||||
|
service Msg {
|
||||||
|
rpc Deploy(MsgDeploy) returns (MsgDeployResponse);
|
||||||
|
rpc Execute(MsgExecute) returns (MsgExecuteResponse);
|
||||||
|
rpc Migrate(MsgMigrate) returns (MsgMigrateResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgDeploy {
|
||||||
|
string sender = 1;
|
||||||
|
string kind = 2;
|
||||||
|
google.Protobuf.Any init_message = 3;
|
||||||
|
repeated google.Protobuf.Any authorize_messages = 4 [(gogoproto.nullable) = false];
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgDeployResponse {
|
||||||
|
string address = 1;
|
||||||
|
uint64 id = 2;
|
||||||
|
google.Protobuf.Any data = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgExecute {
|
||||||
|
string sender = 1;
|
||||||
|
string address = 2;
|
||||||
|
google.Protobuf.Any message = 3;
|
||||||
|
repeated google.Protobuf.Any authorize_messages = 4 [(gogoproto.nullable) = false];
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgExecuteResponse {
|
||||||
|
google.Protobuf.Any data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgMigrate {
|
||||||
|
string sender = 1;
|
||||||
|
string new_account_kind = 2;
|
||||||
|
google.Protobuf.Any migrate_message = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgMigrateResponse {
|
||||||
|
google.Protobuf.Any data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### MsgDeploy
|
||||||
|
|
||||||
|
Deploys a new instance of the given account `kind` with initial settings represented by the `init_message` which is a `google.Protobuf.Any`.
|
||||||
|
Of course the `init_message` can be empty. A response is returned containing the account ID and humanised address, alongside some response
|
||||||
|
that the account instantiation might produce.
|
||||||
|
|
||||||
|
#### Address derivation
|
||||||
|
|
||||||
|
In order to decouple public keys from account addresses, we introduce a new address derivation mechanism which is
|
||||||
|
|
||||||
|
#### MsgExecute
|
||||||
|
|
||||||
|
Sends a `StateTransition` execution request, where the state transition is represented by the `message` which is a `google.Protobuf.Any`.
|
||||||
|
The account can then decide if to process it or not based on the `sender`.
|
||||||
|
|
||||||
|
### MsgMigrate
|
||||||
|
|
||||||
|
Migrates an account to a new version of itself, the new version is represented by the `new_account_kind`. The state transition
|
||||||
|
can only be incepted by the account itself, which means that the `sender` must be the account address itself. During the migration
|
||||||
|
the account current state is given to the new version of the account, which then executes the migration logic using the `migrate_message`,
|
||||||
|
it might change state or not, it's up to the account to decide. The response contains possible data that the account might produce
|
||||||
|
after the migration.
|
||||||
|
|
||||||
|
#### Authorize Messages
|
||||||
|
|
||||||
|
The `Deploy` and `Execute` messages have a field in common called `authorize_messages`, these messages are messages that the account
|
||||||
|
can execute on behalf of the sender. For example, in case an account is expecting some funds to be sent from the sender,
|
||||||
|
the sender can attach a `MsgSend` that the account can execute on the sender's behalf. These authorizations are short-lived,
|
||||||
|
they live only for the duration of the `Deploy` or `Execute` message execution, or until they are consumed.
|
||||||
|
|
||||||
|
An alternative would have been to add a `funds` field, like it happens in cosmwasm, which guarantees the called contract that
|
||||||
|
the funds are available and sent in the context of the message execution. This would have been a simpler approach, but it would
|
||||||
|
have been limited to the context of `MsgSend` only, where the asset is `sdk.Coins`. The proposed generic way, instead, allows
|
||||||
|
the account to execute any message on behalf of the sender, which is more flexible, it could include NFT send execution, or
|
||||||
|
more complex things like `MsgMultiSend` or `MsgDelegate`, etc.
|
||||||
|
|
||||||
|
### Further discussion
|
||||||
|
|
||||||
|
#### Sub-accounts
|
||||||
|
|
||||||
|
We could provide a way to link accounts to other accounts. Maybe during deployment the sender could decide to link the
|
||||||
|
newly created to its own account, although there might be use-cases for which the deployer is different from the account
|
||||||
|
that needs to be linked, in this case a handshake protocol on linking would need to be defined.
|
||||||
|
|
||||||
|
#### Predictable address creation
|
||||||
|
|
||||||
|
We need to provide a way to create an account with a predictable address, this might serve a lot of purposes, like accounts
|
||||||
|
wanting to generate an address that:
|
||||||
|
|
||||||
|
- nobody else can claim besides the account used to generate the new account
|
||||||
|
- is predictable
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
|
||||||
|
message MsgDeployPredictable {
|
||||||
|
string sender = 1;
|
||||||
|
uint32 nonce = 2;
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And then the address becomes `bechify(concat(sender, nonce))`
|
||||||
|
|
||||||
|
`x/accounts` would still use the monotonically increasing sequence as account number.
|
||||||
|
|
||||||
|
#### Joining Multiple Accounts
|
||||||
|
|
||||||
|
As developers are building new kinds of accounts, it becomes necessary to provide a default way to combine the
|
||||||
|
functionalities of different account types. This allows developers to avoid duplicating code and enables end-users to
|
||||||
|
create or migrate to accounts with multiple functionalities without requiring custom development.
|
||||||
|
|
||||||
|
To address this need, we propose the inclusion of a default account type called "MultiAccount". The MultiAccount type is
|
||||||
|
designed to merge the functionalities of other accounts by combining their execution, query, and migration APIs.
|
||||||
|
The account joining process would only fail in the case of API (intended as non-state Schema APIs) conflicts, ensuring
|
||||||
|
compatibility and consistency.
|
||||||
|
|
||||||
|
With the introduction of the MultiAccount type, users would have the option to either migrate their existing accounts to
|
||||||
|
a MultiAccount type or extend an existing MultiAccount with newer APIs. This flexibility empowers users to leverage
|
||||||
|
various account functionalities without compromising compatibility or resorting to manual code duplication.
|
||||||
|
|
||||||
|
The MultiAccount type serves as a standardized solution for combining different account functionalities within the
|
||||||
|
cosmos-sdk ecosystem. By adopting this approach, developers can streamline the development process and users can benefit
|
||||||
|
from a modular and extensible account system.
|
||||||
|
|
||||||
|
# ADR 071: Cryptography v2- Multi-curve support
|
||||||
|
|
||||||
|
## Change log
|
||||||
|
|
||||||
|
- May 7th 2024: Initial Draft (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
|
||||||
|
- June 13th 2024: Add CometBFT implementation proposal (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
|
||||||
|
- July 2nd 2024: Split ADR proposal, add link to ADR in cosmos/crypto (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
DRAFT
|
||||||
|
|
||||||
|
## Abstract
|
||||||
|
|
||||||
|
This ADR proposes the refactoring of the existing `Keyring` and `cosmos-sdk/crypto` code to implement [ADR-001-CryptoProviders](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md).
|
||||||
|
|
||||||
|
For in-depth details of the `CryptoProviders` and their design please refer to ADR mentioned above.
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The introduction of multi-curve support in the cosmos-sdk cryptographic package offers significant advantages. By not being restricted to a single cryptographic curve, developers can choose the most appropriate curve based on security, performance, and compatibility requirements. This flexibility enhances the application's ability to adapt to evolving security standards and optimizes performance for specific use cases, helping to future-proofing the sdk's cryptographic capabilities.
|
||||||
|
|
||||||
|
The enhancements in this proposal not only render the ["Keyring ADR"](https://github.com/cosmos/cosmos-sdk/issues/14940) obsolete, but also encompass its key aspects, replacing it with a more flexible and comprehensive approach. Furthermore, the gRPC service proposed in the mentioned ADR can be easily implemented as a specialized `CryptoProvider`.
|
||||||
|
|
||||||
|
### Glossary
|
||||||
|
|
||||||
|
1. **Interface**: In the context of this document, "interface" refers to Go's interface.
|
||||||
|
|
||||||
|
2. **Module**: In this document, "module" refers to a Go module.
|
||||||
|
|
||||||
|
3. **Package**: In the context of Go, a "package" refers to a unit of code organization.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
In order to fully understand the need for changes and the proposed improvements, it's crucial to consider the current state of affairs:
|
||||||
|
|
||||||
|
- The Cosmos SDK currently lacks a comprehensive ADR for the cryptographic package.
|
||||||
|
|
||||||
|
- If a blockchain project requires a cryptographic curve that is not supported by the current SDK, the most likely scenario is that they will need to fork the SDK repository and make modifications. These modifications could potentially make the fork incompatible with future updates from the upstream SDK, complicating maintenance and integration.
|
||||||
|
|
||||||
|
- Type leakage of specific crypto data types expose backward compatibility and extensibility challenges.
|
||||||
|
|
||||||
|
- The demand for a more flexible and extensible approach to cryptography and address management is high.
|
||||||
|
|
||||||
|
- Architectural changes are necessary to resolve many of the currently open issues related to new curves support.
|
||||||
|
|
||||||
|
- There is a current trend towards modularity in the Interchain stack (e.g., runtime modules).
|
||||||
|
|
||||||
|
- Security implications are a critical consideration during the redesign work.
|
||||||
|
|
||||||
|
## Objectives
|
||||||
|
|
||||||
|
The key objectives for this proposal are:
|
||||||
|
|
||||||
|
- Leverage `CryptoProviders`: Utilize them as APIs for cryptographic tools, ensuring modularity, flexibility, and ease of integration.
|
||||||
|
|
||||||
|
Developer-Centric Approach
|
||||||
|
|
||||||
|
- Prioritize clear, intuitive interfaces and best-practice design principles.
|
||||||
|
|
||||||
|
Quality Assurance
|
||||||
|
|
||||||
|
- Enhanced Test Coverage: Improve testing methodologies to ensure the robustness and reliability of the module.
|
||||||
|
|
||||||
|
## Technical Goals
|
||||||
|
|
||||||
|
New Keyring:
|
||||||
|
|
||||||
|
- Design a new `Keyring` interface with modular backends injection system to support hardware devices and cloud-based HSMs. This feature is optional and tied to complexity; if it proves too complex, it will be deferred to a future release as an enhancement.
|
||||||
|
|
||||||
|
## Proposed architecture
|
||||||
|
|
||||||
|
### Components
|
||||||
|
|
||||||
|
The main components to be used will be the same as those found in the [ADR-001](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#components).
|
||||||
|
|
||||||
|
#### Storage and persistence
|
||||||
|
|
||||||
|
The storage and persistence layer is tasked with storing a `CryptoProvider`s. Specifically, this layer must:
|
||||||
|
|
||||||
|
- Securely store the crypto provider's associated private key (only if stored locally, otherwise a reference to the private key will be stored instead).
|
||||||
|
- Store the [`ProviderMetadata`](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#metadata) struct which contains the data that distinguishes that provider.
|
||||||
|
|
||||||
|
The purpose of this layer is to ensure that upon retrieval of the persisted data, we can access the provider's type, version, and specific configuration (which varies based on the provider type). This information will subsequently be utilized to initialize the appropriate factory, as detailed in the following section on the factory pattern.
|
||||||
|
|
||||||
|
The storage proposal involves using a modified version of the [Record](https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/crypto/keyring/v1/record.proto) struct, which is already defined in **Keyring/v1**. Additionally, we propose utilizing the existing keyring backends (keychain, filesystem, memory, etc.) to store these `Record`s in the same manner as the current **Keyring/v1**.
|
||||||
|
|
||||||
|
_Note: This approach will facilitate a smoother migration path from the current Keyring/v1 to the proposed architecture._
|
||||||
|
|
||||||
|
Below is the proposed protobuf message to be included in the modified `Record.proto` file
|
||||||
|
|
||||||
|
##### Protobuf message structure
|
||||||
|
|
||||||
|
The [record.proto](https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/crypto/keyring/v1/record.proto) file will be modified to include the `CryptoProvider` message as an optional field as follows.
|
||||||
|
|
||||||
|
```protobuf
|
||||||
|
|
||||||
|
// record.proto
|
||||||
|
|
||||||
|
message Record {
|
||||||
|
string name = 1;
|
||||||
|
google.protobuf.Any pub_key = 2;
|
||||||
|
|
||||||
|
oneof item {
|
||||||
|
Local local = 3;
|
||||||
|
Ledger ledger = 4;
|
||||||
|
Multi multi = 5;
|
||||||
|
Offline offline = 6;
|
||||||
|
CryptoProvider crypto_provider = 7; // <- New
|
||||||
|
}
|
||||||
|
|
||||||
|
message Local {
|
||||||
|
google.protobuf.Any priv_key = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Ledger {
|
||||||
|
hd.v1.BIP44Params path = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Multi {}
|
||||||
|
|
||||||
|
message Offline {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Creating and loading a `CryptoProvider`
|
||||||
|
|
||||||
|
For creating providers, we propose a _factory pattern_ and a _registry_ for these builders. Examples of these
|
||||||
|
patterns can be found [here](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#illustrative-code-snippets)
|
||||||
|
|
||||||
|
##### Keyring
|
||||||
|
|
||||||
|
The new `Keyring` interface will serve as a central hub for managing and fetching `CryptoProviders`. To ensure a smoother migration path, the new Keyring will be backward compatible with the previous version. Since this will be the main API from which applications will obtain their `CryptoProvider` instances, the proposal is to extend the Keyring interface to include the methods:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type KeyringV2 interface {
|
||||||
|
// methods from Keyring/v1
|
||||||
|
|
||||||
|
// ListCryptoProviders returns a list of all the stored CryptoProvider metadata.
|
||||||
|
ListCryptoProviders() ([]ProviderMetadata, error)
|
||||||
|
|
||||||
|
// GetCryptoProvider retrieves a specific CryptoProvider by its id.
|
||||||
|
GetCryptoProvider(id string) (CryptoProvider, error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
_Note_: Methods to obtain a provider from a public key or other means that make it easier to load the desired provider can be added.
|
||||||
|
|
||||||
|
##### Especial use case: remote signers
|
||||||
|
|
||||||
|
It's important to note that the `CryptoProvider` interface is versatile enough to be implemented as a remote signer. This capability allows for the integration of remote cryptographic operations, which can be particularly useful in distributed or cloud-based environments where local cryptographic resources are limited or need to be managed centrally.
|
||||||
|
|
||||||
|
## Alternatives
|
||||||
|
|
||||||
|
It is important to note that all the code presented in this document is not in its final form and could be subject to changes at the time of implementation. The examples and implementations discussed should be interpreted as alternatives, providing a conceptual framework rather than definitive solutions. This flexibility allows for adjustments based on further insights, technical evaluations, or changing requirements as development progresses.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
We will:
|
||||||
|
|
||||||
|
- Leverage crypto providers
|
||||||
|
- Refactor the module structure as described above.
|
||||||
|
- Define types and interfaces as the code attached.
|
||||||
|
- Refactor existing code into new structure and interfaces.
|
||||||
|
- Implement Unit Tests to ensure no backward compatibility issues.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
### Impact on the SDK codebase
|
||||||
|
|
||||||
|
We can divide the impact of this ADR into two main categories: state machine code and client related code.
|
||||||
|
|
||||||
|
#### Client
|
||||||
|
|
||||||
|
The major impact will be on the client side, where the current `Keyring` interface will be replaced by the new `KeyringV2` interface. At first, the impact will be low since `CryptoProvider` is an optional field in the `Record` message, so there's no mandatory requirement for migrating to this new concept right away. This allows a progressive transition where the risks of breaking changes or regressions are minimized.
|
||||||
|
|
||||||
|
#### State Machine
|
||||||
|
|
||||||
|
The impact on the state machine code will be minimal, the modules affected (at the time of writing this ADR)
|
||||||
|
are the `x/accounts` module, specifically the `Authenticate` function and the `x/auth/ante` module. This function will need to be adapted to use a `CryptoProvider` service to make use of the `Verifier` instance.
|
||||||
|
|
||||||
|
Worth mentioning that there's also the alternative of using `Verifier` instances in a standalone fashion (see note below).
|
||||||
|
|
||||||
|
The specific way to adapt these modules will be deeply analyzed and decided at implementation time of this ADR.
|
||||||
|
|
||||||
|
_Note_: All cryptographic tools (hashers, verifiers, signers, etc.) will continue to be available as standalone packages that can be imported and utilized directly without the need for a `CryptoProvider` instance. However, the `CryptoProvider` is the recommended method for using these tools as it offers a more secure way to handle sensitive data, enhanced modularity, and the ability to store configurations and metadata within the `CryptoProvider` definition.
|
||||||
|
|
||||||
|
### Backwards Compatibility
|
||||||
|
|
||||||
|
The proposed migration path is similar to what the cosmos-sdk has done in the past. To ensure a smooth transition, the following steps will be taken:
|
||||||
|
|
||||||
|
Once ADR-001 is implemented with a stable release:
|
||||||
|
|
||||||
|
- Deprecate the old crypto package. The old crypto package will still be usable, but it will be marked as deprecated and users can opt to use the new package.
|
||||||
|
- Migrate the codebase to use the new cosmos/crypto package and remove the old crypto one.
|
||||||
|
|
||||||
|
### Positive
|
||||||
|
|
||||||
|
- Single place of truth
|
||||||
|
- Easier to use interfaces
|
||||||
|
- Easier to extend
|
||||||
|
- Unit test for each crypto package
|
||||||
|
- Greater maintainability
|
||||||
|
- Incentivize addition of implementations instead of forks
|
||||||
|
- Decoupling behavior from implementation
|
||||||
|
- Sanitization of code
|
||||||
|
|
||||||
|
### Negative
|
||||||
|
|
||||||
|
- It will involve an effort to adapt existing code.
|
||||||
|
- It will require attention to detail and audition.
|
||||||
|
|
||||||
|
### Neutral
|
||||||
|
|
||||||
|
- It will involve extensive testing.
|
||||||
|
|
||||||
|
## Test Cases
|
||||||
|
|
||||||
|
- The code will be unit tested to ensure a high code coverage
|
||||||
|
- There should be integration tests around Keyring and CryptoProviders.
|
||||||
|
|
||||||
|
> While an ADR is in the DRAFT or PROPOSED stage, this section should contain a
|
||||||
|
> summary of issues to be solved in future iterations (usually referencing comments
|
||||||
|
> from a pull-request discussion).
|
||||||
|
>
|
||||||
|
> Later, this section can optionally list ideas or improvements the author or
|
||||||
|
> reviewers found during the analysis of this ADR.
|
||||||
|
|
||||||
|
# ADR-71 Bank V2
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
DRAFT
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
- 2024-05-08: Initial Draft (@samricotta, @julienrbrt)
|
||||||
|
|
||||||
|
## Abstract
|
||||||
|
|
||||||
|
The primary objective of refactoring the bank module is to simplify and enhance the functionality of the Cosmos SDK. Over time the bank module has been burdened with numerous responsibilities including transaction handling, account restrictions, delegation counting, and the minting and burning of coins.
|
||||||
|
|
||||||
|
In addition to the above, the bank module is currently too rigid and handles too many tasks, so this proposal aims to streamline the module by focusing on core functions `Send`, `Mint`, and `Burn`.
|
||||||
|
|
||||||
|
Currently, the module is split across different keepers with scattered and duplicates functionalities (with 4 send functions for instance).
|
||||||
|
|
||||||
|
Additionally, the integration of the token factory into the bank module allows for standardization, and better integration within the core modules.
|
||||||
|
|
||||||
|
This rewrite will reduce complexity and enhance the efficiency and UX of the bank module.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
The current implementation of the bank module is characterised by its handling of a broad array of functions, leading to significant complexity in using and extending the bank module.
|
||||||
|
|
||||||
|
These issues have underscored the need for a refactoring strategy that simplifies the module’s architecture and focuses on its most essential operations.
|
||||||
|
|
||||||
|
Additionally, there is an overlap in functionality with a Token Factory module, which could be integrated to streamline oper.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
**Permission Tightening**: Access to the module can be restricted to selected denominations only, ensuring that it operates within designated boundaries and does not exceed its intended scope. Currently, the permissions allow all denoms, so this should be changed. Send restrictions functionality will be maintained.
|
||||||
|
|
||||||
|
**Simplification of Logic**: The bank module will focus on core functionalities `Send`, `Mint`, and `Burn`. This refinement aims to streamline the architecture, enhancing both maintainability and performance.
|
||||||
|
|
||||||
|
**Integration of Token Factory**: The Token Factory will be merged into the bank module. This consolidation of related functionalities aims to reduce redundancy and enhance coherence within the system. Migrations functions will be provided for migrating from Osmosis' Token Factory module to bank/v2.
|
||||||
|
|
||||||
|
**Legacy Support**: A legacy wrapper will be implemented to ensure compatibility with about 90% of existing functions. This measure will facilitate a smooth transition while keeping older systems functional.
|
||||||
|
|
||||||
|
**Denom Implementation**: A asset interface will be added to standardise interactions such as transfers, balance inquiries, minting, and burning across different tokens. This will allow the bank module to support arbitrary asset types, enabling developers to implement custom, ERC20-like denominations.
|
||||||
|
|
||||||
|
For example, currently if a team would like to extend the transfer method the changes would apply universally, affecting all denom’s. With the proposed Asset Interface, it allows teams to customise or extend the transfer method specifically for their own tokens without impacting others.
|
||||||
|
|
||||||
|
These improvements are expected to enhance the flexibility of the bank module, allowing for the creation of custom tokens similar to ERC20 standards and assets backed by CosmWasm (CW) contracts. The integration efforts will also aim to unify CW20 with bank coins across the Cosmos chains.
|
||||||
|
|
||||||
|
Example of denom interface:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type AssetInterface interface {
|
||||||
|
Transfer(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coin) error
|
||||||
|
Mint(ctx sdk.Context, to sdk.AccAddress, amount sdk.Coin) error
|
||||||
|
Burn(ctx sdk.Context, from sdk.AccAddress, amount sdk.Coin) error
|
||||||
|
QueryBalance(ctx sdk.Context, account sdk.AccAddress) (sdk.Coin, error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Overview of flow:
|
||||||
|
|
||||||
|
1. Alice initiates a transfer by entering Bob's address and the amount (100 ATOM)
|
||||||
|
2. The Bank module verifies that the ATOM token implements the `AssetInterface` by querying the `ATOM_Denom_Account`, which is an `x/account` denom account.
|
||||||
|
3. The Bank module executes the transfer by subtracting 100 ATOM from Alice’s balance and adding 100 ATOM to Bob’s balance.
|
||||||
|
4. The Bank module calls the Transfer method on the `ATOM_Denom_Account`. The Transfer method, defined in the `AssetInterface`, handles the logic to subtract 100 ATOM from Alice’s balance and add 100 ATOM to Bob’s balance.
|
||||||
|
5. The Bank module updates the chain and returns the new balances.
|
||||||
|
6. Both Alice and Bob successfully receive the updated balances.
|
||||||
|
|
||||||
|
## Migration Plans
|
||||||
|
|
||||||
|
Bank is a widely used module, so getting a v2 needs to be thought thoroughly. In order to not force all dependencies to immediately migrate to bank/v2, the same _upgrading_ path will be taken as for the `gov` module.
|
||||||
|
|
||||||
|
This means `cosmossdk.io/bank` will stay one module and there won't be a new `cosmossdk.io/bank/v2` go module. Instead the bank protos will be versioned from `v1beta1` (current bank) to `v2`.
|
||||||
|
|
||||||
|
Bank `v1beta1` endpoints will use the new bank v2 implementation for maximum backward compatibility.
|
||||||
|
|
||||||
|
The bank `v1beta1` keepers will be deprecated and potentially eventually removed, but its proto and messages definitions will remain.
|
||||||
|
|
||||||
|
Additionally, as bank plans to integrate token factory, migrations functions will be provided to migrate from Osmosis token factory implementation (most widely used implementation) to the new bank/v2 token factory.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
### Positive
|
||||||
|
|
||||||
|
- Simplified interaction with bank APIs
|
||||||
|
- Backward compatible changes (no contracts or apis broken)
|
||||||
|
- Optional migration (note: bank `v1beta1` won't get any new feature after bank `v2` release)
|
||||||
|
|
||||||
|
### Neutral
|
||||||
|
|
||||||
|
- Asset implementation not available cross-chain (IBC-ed custom asset should possibly fallback to the default implementation)
|
||||||
|
- Many assets may slow down bank balances requests
|
||||||
|
|
||||||
|
### Negative
|
||||||
|
|
||||||
|
- Temporarily duplicate functionalities as bank `v1beta1` are `v2` are living alongside
|
||||||
|
- Difficultity to ever completely remove bank `v1beta1`
|
||||||
|
|
||||||
|
### References
|
||||||
|
|
||||||
|
- Current bank module implementation: https://github.com/cosmos/cosmos-sdk/blob/v0.50.6/x/bank/keeper/keeper.go#L22-L53
|
||||||
|
- Osmosis token factory: https://github.com/osmosis-labs/osmosis/tree/v25.0.0/x/tokenfactory/keeper
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user