infernet-1.0.0 update
This commit is contained in:
@ -7,12 +7,15 @@ ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PIP_NO_CACHE_DIR 1
|
||||
ENV RUNTIME docker
|
||||
ENV PYTHONPATH src
|
||||
ARG index_url
|
||||
ENV UV_EXTRA_INDEX_URL ${index_url}
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y git curl
|
||||
|
||||
# install uv
|
||||
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
|
||||
ADD https://astral.sh/uv/install.sh /install.sh
|
||||
RUN chmod 755 /install.sh
|
||||
RUN /install.sh && rm /install.sh
|
||||
|
||||
COPY src/requirements.txt .
|
||||
|
@ -4,7 +4,7 @@ TAG := $(DOCKER_ORG)/hello-world-infernet:latest
|
||||
.phony: build run publish
|
||||
|
||||
build:
|
||||
@docker build -t $(TAG) .
|
||||
@docker build -t $(TAG) --build-arg index_url=$(index_url) .
|
||||
|
||||
update-tag:
|
||||
jq ".containers[0].image = \"$(TAG)\"" config.json > updated_config.json && mv updated_config.json config.json
|
||||
|
@ -50,7 +50,7 @@ file with the following content:
|
||||
|
||||
```
|
||||
Flask>=3.0.0,<4.0.0
|
||||
gunicorn>=21.2.0,<22.0.0
|
||||
gunicorn>=22.0.0,<23.0.0
|
||||
```
|
||||
|
||||
## Step 2: create a Dockerfile
|
||||
|
@ -1,50 +1,44 @@
|
||||
{
|
||||
"log_path": "infernet_node.log",
|
||||
"server": {
|
||||
"port": 4000
|
||||
},
|
||||
"chain": {
|
||||
"enabled": true,
|
||||
"trail_head_blocks": 0,
|
||||
"rpc_url": "http://host.docker.internal:8545",
|
||||
"coordinator_address": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
|
||||
"wallet": {
|
||||
"max_gas_limit": 4000000,
|
||||
"private_key": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
||||
}
|
||||
},
|
||||
"startup_wait": 1.0,
|
||||
"docker": {
|
||||
"username": "your-username",
|
||||
"password": ""
|
||||
},
|
||||
"redis": {
|
||||
"host": "redis",
|
||||
"port": 6379
|
||||
},
|
||||
"forward_stats": true,
|
||||
"containers": [
|
||||
{
|
||||
"id": "hello-world",
|
||||
"image": "ritualnetwork/hello-world-infernet:latest",
|
||||
"external": true,
|
||||
"port": "3000",
|
||||
"allowed_delegate_addresses": [],
|
||||
"allowed_addresses": [],
|
||||
"allowed_ips": [],
|
||||
"command": "--bind=0.0.0.0:3000 --workers=2",
|
||||
"env": {}
|
||||
"log_path": "infernet_node.log",
|
||||
"server": {
|
||||
"port": 4000
|
||||
},
|
||||
{
|
||||
"id": "anvil-node",
|
||||
"image": "ritualnetwork/infernet-anvil:0.0.0",
|
||||
"external": true,
|
||||
"port": "8545",
|
||||
"allowed_delegate_addresses": [],
|
||||
"allowed_addresses": [],
|
||||
"allowed_ips": [],
|
||||
"command": "",
|
||||
"env": {}
|
||||
}
|
||||
]
|
||||
"chain": {
|
||||
"enabled": true,
|
||||
"trail_head_blocks": 0,
|
||||
"rpc_url": "http://host.docker.internal:8545",
|
||||
"registry_address": "0x663F3ad617193148711d28f5334eE4Ed07016602",
|
||||
"wallet": {
|
||||
"max_gas_limit": 4000000,
|
||||
"private_key": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
||||
}
|
||||
},
|
||||
"startup_wait": 1.0,
|
||||
"docker": {
|
||||
"username": "your-username",
|
||||
"password": ""
|
||||
},
|
||||
"redis": {
|
||||
"host": "redis",
|
||||
"port": 6379
|
||||
},
|
||||
"forward_stats": true,
|
||||
"snapshot_sync": {
|
||||
"sleep": 3,
|
||||
"batch_size": 100
|
||||
},
|
||||
"containers": [
|
||||
{
|
||||
"id": "hello-world",
|
||||
"image": "ritualnetwork/hello-world-infernet:latest",
|
||||
"external": true,
|
||||
"port": "3000",
|
||||
"allowed_delegate_addresses": [],
|
||||
"allowed_addresses": [],
|
||||
"allowed_ips": [],
|
||||
"command": "--bind=0.0.0.0:3000 --workers=2",
|
||||
"env": {},
|
||||
"accepted_payments": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
Flask>=3.0.0,<4.0.0
|
||||
gunicorn>=21.2.0,<22.0.0
|
||||
gunicorn>=22.0.0,<23.0.0
|
||||
|
@ -58,7 +58,7 @@ import {console2} from "forge-std/console2.sol";
|
||||
import {CallbackConsumer} from "infernet-sdk/consumer/Callback.sol";
|
||||
|
||||
contract SaysGM is CallbackConsumer {
|
||||
constructor(address coordinator) CallbackConsumer(coordinator) {}
|
||||
constructor(address registry) CallbackConsumer(registry) {}
|
||||
|
||||
function sayGM() public {
|
||||
_requestCompute(
|
||||
@ -128,9 +128,9 @@ contract Deploy is Script {
|
||||
address deployerAddress = vm.addr(deployerPrivateKey);
|
||||
console2.log("Loaded deployer: ", deployerAddress);
|
||||
|
||||
address coordinator = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
|
||||
address registry = 0x663F3ad617193148711d28f5334eE4Ed07016602;
|
||||
// Create consumer
|
||||
SaysGM saysGm = new SaysGM(coordinator);
|
||||
SaysGM saysGm = new SaysGM(registry);
|
||||
console2.log("Deployed SaysHello: ", address(saysGm));
|
||||
|
||||
// Execute
|
||||
@ -160,7 +160,7 @@ contract CallContract is Script {
|
||||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
|
||||
vm.startBroadcast(deployerPrivateKey);
|
||||
|
||||
SaysGM saysGm = SaysGM(0x663F3ad617193148711d28f5334eE4Ed07016602);
|
||||
SaysGM saysGm = SaysGM(0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e);
|
||||
|
||||
saysGm.sayGM();
|
||||
|
||||
|
Submodule projects/hello-world/contracts/lib/forge-std updated: e4aef94c17...52715a217d
Submodule projects/hello-world/contracts/lib/infernet-sdk updated: 2d04a7f5ed...8e6cd6f5cb
@ -1,2 +1,3 @@
|
||||
forge-std/=lib/forge-std/src
|
||||
infernet-sdk/=lib/infernet-sdk/src
|
||||
solady/=lib/infernet-sdk/lib/solady/src
|
||||
|
@ -10,7 +10,7 @@ contract CallContract is Script {
|
||||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
|
||||
vm.startBroadcast(deployerPrivateKey);
|
||||
|
||||
SaysGM saysGm = SaysGM(0x663F3ad617193148711d28f5334eE4Ed07016602);
|
||||
SaysGM saysGm = SaysGM(0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e);
|
||||
|
||||
saysGm.sayGM();
|
||||
|
||||
|
@ -14,9 +14,9 @@ contract Deploy is Script {
|
||||
address deployerAddress = vm.addr(deployerPrivateKey);
|
||||
console2.log("Loaded deployer: ", deployerAddress);
|
||||
|
||||
address coordinator = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
|
||||
address registry = 0x663F3ad617193148711d28f5334eE4Ed07016602;
|
||||
// Create consumer
|
||||
SaysGM saysGm = new SaysGM(coordinator);
|
||||
SaysGM saysGm = new SaysGM(registry);
|
||||
console2.log("Deployed SaysHello: ", address(saysGm));
|
||||
|
||||
// Execute
|
||||
|
@ -5,15 +5,17 @@ import {console2} from "forge-std/console2.sol";
|
||||
import {CallbackConsumer} from "infernet-sdk/consumer/Callback.sol";
|
||||
|
||||
contract SaysGM is CallbackConsumer {
|
||||
constructor(address coordinator) CallbackConsumer(coordinator) {}
|
||||
constructor(address registry) CallbackConsumer(registry) {}
|
||||
|
||||
function sayGM() public {
|
||||
_requestCompute(
|
||||
"hello-world",
|
||||
bytes("Good morning!"),
|
||||
20 gwei,
|
||||
1_000_000,
|
||||
1
|
||||
1, // redundancy
|
||||
address(0), // paymentToken
|
||||
0, // paymentAmount
|
||||
address(0), // wallet
|
||||
address(0) // prover
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,7 +26,9 @@ contract SaysGM is CallbackConsumer {
|
||||
address node,
|
||||
bytes calldata input,
|
||||
bytes calldata output,
|
||||
bytes calldata proof
|
||||
bytes calldata proof,
|
||||
bytes32 containerId,
|
||||
uint256 index
|
||||
) internal override {
|
||||
console2.log("\n\n"
|
||||
"_____ _____ _______ _ _ _\n"
|
||||
@ -43,6 +47,8 @@ contract SaysGM is CallbackConsumer {
|
||||
console2.logBytes(input);
|
||||
console2.log("output:");
|
||||
console2.logBytes(output);
|
||||
(string memory decoded)= abi.decode(output, (string));
|
||||
console2.log("decoded output: ", decoded);
|
||||
console2.log("proof:");
|
||||
console2.logBytes(proof);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ This project already comes with a pre-filled config file. The config file for th
|
||||
[here](container/config.json):
|
||||
|
||||
```bash
|
||||
projects/hello-world/config.json
|
||||
projects/hello-world/container/config.json
|
||||
```
|
||||
|
||||
## Requesting an on-chain job
|
||||
@ -92,7 +92,7 @@ We already have a public [anvil node](https://hub.docker.com/r/ritualnetwork/inf
|
||||
corresponding infernet sdk contracts deployed, along with a node that has
|
||||
registered itself to listen to on-chain subscription events.
|
||||
|
||||
* Coordinator Address: `0x5FbDB2315678afecb367f032d93F642f64180aa3`
|
||||
* Registry Address: `0x663F3ad617193148711d28f5334eE4Ed07016602`
|
||||
* Node Address: `0x70997970C51812dc3A010C7d01b50e0d17dc79C8` (This is the second account in the anvil's accounts.)
|
||||
|
||||
### Deploying Infernet Node & Infernet's Anvil Testnet
|
||||
@ -140,7 +140,7 @@ eth_sendRawTransaction
|
||||
eth_getTransactionReceipt
|
||||
|
||||
Transaction: 0x23ca6b1d1823ad5af175c207c2505112f60038fc000e1e22509816fa29a3afd6
|
||||
Contract created: 0x663f3ad617193148711d28f5334ee4ed07016602
|
||||
Contract created: 0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e
|
||||
Gas used: 476669
|
||||
|
||||
Block Number: 1
|
||||
@ -152,7 +152,7 @@ eth_getTransactionReceipt
|
||||
eth_blockNumber
|
||||
```
|
||||
|
||||
We can see that a new contract has been created at `0x663f3ad617193148711d28f5334ee4ed07016602`.
|
||||
We can see that a new contract has been created at `0x13D69Cf7d6CE4218F646B759Dcf334D82c023d8e`.
|
||||
That's the address of the `SaysGM` contract.
|
||||
|
||||
### Calling the contract
|
||||
|
Reference in New Issue
Block a user